Template for regular posts (no custom post types)

If you take a look at Template Hierarchy category-news.php would be archive template, that is for a list of multiple posts having specific category. There is no such thing as template for individual post, having specific category, in native template hierarchy. There are different ways to handle such, depending on your needs. Typical are: styling … Read more

Post Status Frontend Announcement

You can create an easy to use function to do that for you. Like so: <?php function sg_user_posts_by_type($userid, $post_status) { $args = array( ‘numberposts’ => -1, ‘post_status’ => array($post_status), ‘author’ => $userid ); $count_posts = count(get_posts($args)); return $count_posts; } if (is_user_logged_in()) { // GET CURRENT USER DATA $user_id = get_current_user_id(); $user_data = get_userdata($user_id); $publish_count = … Read more

How to edit the ‘

If i am not wrong then i think you are talking about this Blankslate theme. If this is the case then you can edit the older and newer links displayed on archive page by editing the following code by overwriting the theme file nav-below.php in the child theme. <div class=”nav-previous”><?php next_posts_link(sprintf( __( ‘%s older’, ‘blankslate’ … Read more

Exclude a category of posts in author template

Never use query_posts, use pre_get_posts to modify any main query. function wpd_exclude_author_category( $query ) { if ( $query->is_author() && $query->is_main_query() ) { $query->set( ‘category__not_in’, array( 42 ) ); } } add_action( ‘pre_get_posts’, ‘wpd_exclude_author_category’ );

Get post related to particular meta box? [closed]

Something along the lines of: $args = array( ‘posts_per_page’ => 10, ‘post_type’ => ‘post’, ‘meta_key’ => ‘METAkeyNAME’, //what I assume you’ve called a meta box ‘meta_value’ => ‘THEdesiredVALUE’, ‘orderby’ => ‘ID’, //choose to order by anything look here [http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters] for more info ‘order’ => ‘ASC’, ); $results = new WP_Query($args); // ‘<pre>’.print_r($results).'</pre>’; // This is … Read more

Change the background of each post according to the category

I do not know this theme. But you must use this two functions somewhere: get_theme_mod (‘background_image’, $default); set_theme_mod (‘background_image’, $_category_image_absolute_path); Maybe, you can define new modification names with this functions. For example, ‘backgroud_image_entertainment’, ‘background_image_storysode’, etc. (as is shown in the referred web page) by using set_theme_mod. set_theme_mod (‘backround_image_entertainment’, $_category_image_absolute_path); Then, you should add some functions … Read more

Echo the number of posts being displayed

rearrange your code and use post_count; example: <?php $movieNumber = 1; $today = date(‘Ymd’); $posts = array ( ‘post_type’ => ‘movie’, ‘posts_per_page’ => -1, ); $loop = new WP_Query( $posts ); ?> <div id=”posters<?php echo $loop->post_count; ?>”> <?php while ( $loop->have_posts() ) : $loop->the_post(); …etc…