how to exclude “featured” posts from the main loop?

This would be an appropriate use of query_posts(), with a post custom meta query. Since you’re querying by meta_key=featured_article&meta_value=on, you would then exclude on the same parameters. <?php // Setup the custom meta-query args $exclude_featured_args = array( ‘meta_query’ => array( array( ‘key’ => ‘featured_article’, ‘value’ => ‘on’, ‘compare’ => ‘!=’ ) ) ); // globalize … Read more

How to paginate posts correctly that belong to a particular category and are random ordered

You can use the add_filter line inside the template itself & no filter in the “functions.php” file. Then just after retrieving the posts remove that filter with a call to remove_filter. The actual function may still reside in the functions.php file add_filter(‘posts_orderby’, ‘edit_posts_orderby’); // get all the posts for this specific loop here remove_filter(‘posts_orderby’, ‘edit_posts_orderby’); … Read more

orderby:date not working

You should not have to specify orderby=date. That is the default. If you look at the query, you will see that the field used is post_date, which is the publication date and not the modification date– post_modified. You can prove this just by dumping $wp_query after your call to query_posts. Or try: $q = new … Read more

posts_per_page override by default settings

Regarding my comment to Steve’s answer, see also Override the default number of posts to show for a single loop? The “method” version of Steve’s answer would be: function limit_posts_per_archive_page( $query ) { if ( $query->is_post_type_archive( ‘zitate-sprueche’ ) || $query->is_tax(‘zitate-kats’) || $query->is_post_type_archive(‘daten’) || $query->is_tax(‘daten-kats’)) { $limit = 27; } else $limit = get_option(‘posts_per_page’); } $query->set( … Read more

How to reverse the order of WordPress blog posts?

Maybe page.php is not your friend for this one. It depends where is the list of posts you want to modify. Try index.php for homepage or archive.php for category based views. Check http://codex.wordpress.org/Theme_Development#Template_Files_List page.php is used when an individual Page is queried – that means this page is usually the only post displayed there. Playing … Read more

Static Front-Page Excerpts

Is there any particular reason not to use the front-page.php template file, and just not bother with trying to pull WordPress headers into external files? Using the front-page.php template file is easy: Create a new static Page, with any arbitrary name (let’s call it “Front Page”) Go to Dashboard -> Settings -> Reading and set … Read more