WordPress.org

Forums

How to display the Post count one less than it really is (1 post)

  1. Please Add Screenshots
    Member
    Posted 4 years ago #

    Is there a way to make the post count 1 less than it really is?

    Thanks

    <!-- Get number of posts -->                     
    
                    <?php foreach((get_the_category()) as $category) {
    
    					if ($category->count == 1){
    
    					//if there is only one post in the category
    
    					echo $category->category_count, " propriété dans";
    
    					}else if ($category->count > 1){
    
    					//if there is more than one post in this category
    
    					echo $category->category_count, " propriétés dans";
    
    					}else{
    
    					//if there is no post in this category
    
    					echo "aucune propriété dans";
    
    					}
    				} ?>
    
                    <!-- Show Category name -->
    
                    <?php single_cat_title(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 4 years ago by Please Add Screenshots
  • This topic is not resolved
  • WordPress version: 3.0