Looking to exclude blog posts from category Previous/Next buttons

You can exclude categories from your posts page using pre_get_posts function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() && !is_admin()) { $query->set( ‘cat’, ‘-1347’ ); } } add_action( ‘pre_get_posts’, ‘exclude_category’ ); Might be better to use the category slug or I.D. Same with the tag. There’s also 5 parameters you might want to … Read more

How can I specify a category post on my home page

You really should be using custom posts to do what you’re trying to do, but to answer your question here’s a solution (put this in your functions.php file): add_shortcode( ‘job-posts’, ‘rt_list_posts_by_category’ ); function rt_list_posts_by_category($atts) { $a = shortcode_atts( array( ‘link1’ => ‘#’, ‘link2’ => ‘#’, ‘link3’ => ‘#’, ), $atts ); // arguments for function … Read more

Publish posts only after the condition is met

Setup cron job You want to do some action (i.e. publishing a post) periodically, so first you need to schedule a cron job. Cron jobs are actions, that are fired periodically at some sort of a time interval. You can either use (non-perfect) WordPress Cron or replace it with a real cron job on your … Read more

Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?

Now I’ve understand the question, and yes, it makes sense. The filter additions and the third function do not change at all, what change are the first two functions. There is 2 cases: [AuthorName] part in the url is equivalent sanitize_title($guestauthor) where $guestauthor is what is saved in the ‘guest-author’ custom field [AuthorName] part is … Read more

Can I change a post to a page by changing it’s type?

Changing the post_type property of a post is easy, but there are a few con’s you would need to consider here before doing so Non hierarchical post types (like post) behaves way different that hierarchical post types (like page). I’m not going to explain everything here, but in general, most importantly, non hierarchical post types … Read more

Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects

There was an associated post to this one that shed light on this answer. When registering the post type, I was not setting enough fields in the ‘supports’ array of the register_post_type. Adding author, whatdayaknow, gives me the data I’m looking for. Thanks to @milo for being on the right path! register_post_type(self::POST_TYPE, array( ‘labels’ => … Read more

960gs different classes on teasers posts

Even better way is to check the current post position in query: global $wp_query; while (have_posts()) : the_post(); $my_class=””; if ( $wp_query->current_post == 0 ) $my_class=” first”; if ( $wp_query->current_post == $wp_query->post_count – 1 ) $my_class=” last”; ?><div class=”post<?php echo $my_class; ?>”><?php … if ( $wp_query->current_post == $wp_query->post_count – 1 ) echo ‘THE CONTENT UNDER … Read more