Jump to content

Novice@PHP

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by Novice@PHP

  1. Wew I don't want to build it. No time for that. I guess something already exists, I just don't know what to look for. Thanks for the detailed reply though.
  2. I have a website but managing writers is HARD. I need a project management script that assigns articles to a list, that the writers then claim from and submit. I have no idea what kind of script I'm looking for. Quick process: 1. Add a bunch of article titles across a number of categories. 2. Registered writers can claim which titles they want to write but are only allowed to claim in their own topic. 3. Writers write articles, mark as done and submit for review. No idea what to look for but any help hugely appreciated. Thanks.
  3. I don't know what you mean. I tried just putting $listids without the echo and it didn't work. is it fast turnaround and able to deal with small snippets like this?
  4. I'm trying to put the value of the custom field into the array 'include' which is a series of post IDs. The biggest issue is I didn't make all of the query, just some of it. The Post IDs part I made but need those IDs to be passed from a custom field. Thanks for your help, hopefully someone can help. Other than that is there somewhere where I can pay for quick help with small snippets like this? I don't like to be a vampire.
  5. The query above queries posts on a page that already has a post. It's basically a query to query posts inside posts. So I need to pass the post IDS into the include array using custom fields. But No idea how to do it other than what I've got below. Thanks <?php /* Template Name Posts: List More Posts */ ?> <?php get_header(); ?> <!-- BEGIN COL LEFT --> <div id="colLeft"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="postItem"> <!-- google_ad_section_start --> <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1> <div class="categs"><?php the_category(', ') ?></div> <div class="meta"> <div>Last Edited: <?php the_time('M j, Y') ?></div> <div class="icoAuthor">Expert Author: <?php the_author_link(); ?></div> <div class="icoComments"><?php comments_popup_link('No Comments', '1 Comment ', '% Comments'); ?></div> </div> <?php &listids = get_post_meta($post->ID, 'list_array', true); $query_args = array('post_type'=>'post', 'post_status'=>'publish', 'include' => 'echo $listids;', 'orderby' => 'date', 'order' => 'ASC'); $query_posts = get_posts($query_args); $last_query = end($query_posts); foreach ($query_posts as $post) : setup_postdata($post); ?> <?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '" style="float:left;margin-bottom:35px;"'); ?><h3><?php echo get_post_meta($post->ID, 'list_number', true); ?>. <a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3><?php the_excerpt(45); ?><a href="<?php the_permalink(); ?>" class="more">Read More..</a><div style="clear:both;"></div><hr /> <?php endforeach; ?> <span class='st_facebook_hcount' displayText='Facebook'></span> <span class='st_twitter_hcount' displayText='Tweet'></span> <span class='st_pinterest_hcount' displayText='Pinterest'></span> <span class='st_linkedin_hcount' displayText='LinkedIn'></span> <span class='st_sharethis_hcount' displayText='ShareThis'></span><br /> <?php the_tags('<p class="tags">Tags: ', ', ', '</p>'); ?> <div id="howback">IGNORE THIS</div> <?php comments_template(); ?> <?php endwhile; ?> <?php else : ?> <p>Sorry, but you are looking for something that isn't here.</p> <?php endif; ?> </div> <!-- END COL LEFT --> <?php get_sidebar(); ?> <?php get_footer(); ?>
  6. I've made a working query to query Wordpress posts by ID but hit a roadblock. I can't pass the custom field value into the post ID array as that is where I will eneter the values to be used in the array. As seen here: listids being the custom field value. <?php &listids = get_post_meta($post->ID, 'list_array', true); $query_args = array('post_type'=>'post', 'post_status'=>'publish', 'include' => 'echo $listids;', 'orderby' => 'date', 'order' => 'ASC'); $query_posts = get_posts($query_args); $last_query = end($query_posts); foreach ($query_posts as $post) : setup_postdata($post); ?>
  7. Can anyone elaborate on the guy aboves answer and show an example of elseif using the code above without echoing?
  8. I have this code which checks for the word "Big Ben" and if it's not there it outputs some html. I want t be able to make another statement to also check for the word "London Tower" and if it's not there then to check for the word "Canary Wharf", So far I've only managed one statement without the code breaking, how do I add the others in as well. <?php $astacker=get_post_meta($post->ID, 'thesite', true); if ( $astacker == [b]'Big Ben'[/b]) { ?> <?php include(TEMPLATEPATH."/feedsgrabstack.php");?> <?php }else { ?> <div id="splitter"><div class="clear"> <a href="<?php echo get_post_meta($post->ID, "linktosource", true);?>">Click Here To View Answers</a> <span style="float:right;"><a href="#related">See Related Questions</a></div></div> <?php } ?>
  9. I've made up some new code but I have an issue with trying to figure out why it won't work. Do you see any issues with it? $rss = fetch_feed('<?php echo get_post_meta($post->ID, "linktosource", true);?>'); Thanks in advance
  10. I'm testing this now, hopefully it works, but what I don't understand is why would it have worked all these months then just stopped? Thanks all, I'll come back after rigorous testing
  11. This code has worked fine for months: $ret = @preg_replace('«'.stripslashes($pattern).'«i', $this->current_feed['replace'][$i], $this->postinfo[$postfield]); Then the error was saying that this character '�' found in the code (even in notepad) like this: $ret = @preg_replace(''�'.stripslashes($pattern).''�i', $this->current_feed['replace'][$i], $this->postinfo[$postfield]); (had to leave off php tags to show it properly). So I replaced the broken code with the code that has been working for months, but it still keeps saying that the '� is on that line and casuing an unknown modifier?? Thanks
  12. This worked fine up until an hour ago when the "«" was replaced with '�' and it created the error. I then fixed the line but it still keeps saying that the '�' is causing an "Unknown modifier" even though the '�' doesn't even exist in the code any more... ?
  13. $ret = preg_replace('«'.stripslashes($pattern).'«i', $this->current_feed['replace'][$i], $this->postinfo[$postfield]); Could it have cached the file it is using and is still using an old version with the weird question marks? As it's this same error over and over again even though the weird question marks are not in the code any more?
  14. The weird part is this script worked fine, then where the («) are was replaced with those weird question marks so I replaced with the backed up file but still get those errors saying they still exist when they don't any more? Could the script possibly have cached an old version of the way it runs?
  15. I keep getting an "Unknown modifier" error with this line of code in my script: $ret = @preg_replace('«'.stripslashes($pattern).'«i', $this->current_feed['replace'][$i], $this->postinfo[$postfield]); The error says there is a '�' character but when I check the file there are none of them present in the code, though first time I chekced there were then I removed them but error still occurs. preg_replace() [function.preg-replace]: Unknown modifier '�' Is there a case that it is not refreshing the script and I need to delete and replace? (tried this though) Is there an issue with the initial line of code I've shown? (it has worked for weeks up until I changed memory size scripts are allowed to use). The weird issue is that no matter how many times I change the line to the previously working line - the script will still encounter the issue...? All replies thanked in advance and I'll pop back soon to see any suggestions. Thanks.
  16. I can't believe WP is in it's 3rd version and still is really awkward to make a custom post loop by using certain ID's stored in a table. I have 10 id's that dynamically change which are stored in a table outside of wp_posts. It seems even if I do manage to get these Id's Wordpress is pretty useless at being able to make a loop to display the data from them. I've even tried paying someone to do it for me and they said they couldn't do it. Basically all I want is for silly WP to create a loop of 10 posts ID's which are selected from a separate table then let me display them using while have_posts or something similar. I guess WP really is still crap if it can't do this? Here's what they provide for a custom select loops. You'll see that you can't loop by post id. grrr. http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query
  17. Sorry if this is a silly question lol. I want to know if there is an online tool I can use to check and see what PHP code will ouput server side. For example: <?php $tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y")); ?>
  18. Actually correction. I got it. And now believe I understand how to query a database. First time for everything. Thanks dude well appreciated.
  19. Nice thanks for that. I did figure that out eventually. This works perfectly too but (cont below) <?php echo $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' AND `post_date` > ' 2010-01-01 13:24:53'"); if (0 < $numposts) $numposts = number_format($numposts); ?> If I try to use the date("Y") or date("m") like so ' ".date("Y") . "-01-01 13:24:53'"); or ' 2010-".date("m") . "-01 13:24:53'"); It doesn't work. I guess maybe I misunderstand how to add ".date("m") . " in to make sure it is added correctly and ths it won't work unless I do. If I'm not making sense shout at me hehe. Thanks dude.
  20. I've actually just discovered the whole line of code doesn't even work in the first place. All it is doing is grabbing the total number of posts. Not the year.
  21. I have made a bit of code that queries the database for articles published within the last year. <?php echo $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' AND 'post_date' > '" . date("Y") . "-01-01-01 00:00:00'"); if (0 < $numposts) $numposts = number_format($numposts); ?> I really don't even know how it works and need to because I want to figure out how to make it also get articles published within the last day, month and week. I suppose if I understood what needs changing I might be able to work with it but so far everything I've tried either returns the exact same number or nothing at all. It's for Wordpress just to note. Any ideas?
  22. Tjis works much better than anything I tried. Though one issue is that it doesn't echo both inside the <li> but rather image outside and url inside. I tweaked it a little and got it to display them in separate <li>'s but this isn't what i need. Any ideas why they aren't inside the same <li> tags? (by they I mean the .dp_attatchment_image and the permalink fucntion. Thanks.
  23. Doesn't work but thanks for the advice. Still trying to do it lol.
  24. I don't think I'm grasping this concept one little bit. can take me months too unfortunately. What I have today is this line of code echo '<li><?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '" class="footer-thumb" width="40px" height="40px"'); ?><a href="' . get_permalink($id) . '">' . get_the_title($id) . '</a></li>'; It doesn't work because it creates a syntax error. I know it's simple too but still can't get my head round this kind of coding. Thanks to everyone who takes their time to reply.
  25. Wow. That makes much more sense. Should have thought about that one. Hopefully this post ranks in the Google beast so others can benefit from it too. Thank you thank you thank you.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.