Error while excluding a post from another loop (using its ID)
post__not_in accepts an array so change <?php $postid = get_the_ID(); // capture the id ?> to <?php $postid[] = get_the_ID(); // capture the id ?> and you’ll be fine.
post__not_in accepts an array so change <?php $postid = get_the_ID(); // capture the id ?> to <?php $postid[] = get_the_ID(); // capture the id ?> and you’ll be fine.
You can specify either paged for simple pagination, or offset if you want to do something special. Calculating the offset yourself is easy: just multiply the current page number (minus two) with the number of posts per page, and add your start offset: $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $posts_per_page = get_option( ‘posts_per_page’ ), … Read more
You could fetch the post categories, then pass them into wp_list_categories to take care of displaying them hierarchally. Something like.. wp_list_categories( array( ‘include’ => array_keys( get_the_terms( $post->ID, ‘category’ ) ), ‘title_li’ => ” ) ); Hope that helps.. 🙂
Suggest you have a look at http://wordpress.org/support/topic/passing-current-single_tag_title-as-variable-into-new-wp_query – I suspect the very last comment which covers both backing up and reseting your query will help.
Just create a template file called “category-ontario-ohs-reform-alerts.php”. This way any time this category is displayed, your special template will be used.
These files are not loaded directly, but similar to regular template files, only after the WP class is initialized. This class does the main query, which already can include the comments if the correct query variables are set. The execution flow is a follows, starting in the main index.php: require(‘./wp-blog-header.php’); require_once( dirname(__FILE__) . ‘/wp-load.php’ ); … Read more
OK. So I think I figured this one out myself. I’ll document it here for the sake of those who may fall into the same trap. I’ve been using a template file to structure my feed. In my functions.php file, this is what the relevant portions of code looked like before: add_feed(‘weekly_deals’, ‘weekly_deals_create_feed’); function weekly_deals_create_feed(){ … Read more
this could be a dumb answer – but is it because you end the loop and have two loops in one page? If so I’d work around it by putting the news loop into a second file and then call it into the main file…. but again I could be giving u a very basic … Read more
change your query to: <?php $my_query = new WP_Query( array(“cat” => 3, “posts_per_page” => 4, “post__not_in” => array($mainPost))); http://codex.wordpress.org/Function_Reference/WP_Query#Post_.26_Page_Parameters
Make the user query when the job is submitted and put all matching subscribers in a queue. At the end of the day run through the queue once and send the mails.