Replace the post count on wp_list_categories with “Has Posts” instead of number and “No Posts” if none

Add the below in your theme’s functions.php. It should work the way you want function my_list_categories( $output, $args ) { $output = str_replace( ‘(0)’, ‘(No Posts)’, $output ); $output = preg_replace( ‘/\((\d+)\)/’, ‘(Has Posts)’, $output ); return $output; } add_filter( ‘wp_list_categories’, ‘my_list_categories’, 10, 2 );

Get all first images of posts in same category

You can do this, and it isn’t that hard though could be a lot of work for the server. The code, a bit simplified, should look something like this: $cposts = wp_list_pluck($wp_query->posts,’ID’); // var_dump($cposts); // debug $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ =>’image’, ‘post_status’ => ‘inherit’, ‘order’ => ‘DESC’, ‘posts__in’ => $cposts ); // … Read more

Make a category my homepage

You can use pre_get_posts to ‘modify’ the main query to display posts from your specific category only. You will need to use the is_home() conditional to only target the home page of your blog. The parameter cat that you are going to use in your query uses the category ID. You can also use the … Read more

IF have_posts contains posts from a certain category

Per your example, the contents have to be contained in the if/while statement (if they have posts). Otherwise the boxes will appear and the content will be blank, rather than the content AND boxes hidden completely as you want. Try this: <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class=”box”> <h2 class=”archive-title” style=”text-align:center”>Artikel</h2> … Read more

2 Categories using same template but one has a problem? [closed]

This question as mentioned in the comments is not related to wordpress by any means. But anywho remove the float on your #portfolio-item and add some flex like its 2015. #contentportfolio { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-wrap: wrap; -ms-flex-wrap: wrap; flex-wrap: wrap; } People still play sims?