Title: mainguy's Replies | WordPress.org

---

# mainguy

  [  ](https://wordpress.org/support/users/mainguy/)

 *   [Profile](https://wordpress.org/support/users/mainguy/)
 *   [Topics Started](https://wordpress.org/support/users/mainguy/topics/)
 *   [Replies Created](https://wordpress.org/support/users/mainguy/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/mainguy/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/mainguy/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/mainguy/engagements/)
 *   [Favorites](https://wordpress.org/support/users/mainguy/favorites/)

 Search replies:

## Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Post count for a specific category in category.php?](https://wordpress.org/support/topic/post-count-for-a-specific-category-in-categoryphp/)
 *  [mainguy](https://wordpress.org/support/users/mainguy/)
 * (@mainguy)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/post-count-for-a-specific-category-in-categoryphp/#post-1123843)
 * Again, there was another mistake, it should have been “==” instead of “=”
 *     ```
       <!-- 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(); ?>
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Post count for a specific category in category.php?](https://wordpress.org/support/topic/post-count-for-a-specific-category-in-categoryphp/)
 *  [mainguy](https://wordpress.org/support/users/mainguy/)
 * (@mainguy)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/post-count-for-a-specific-category-in-categoryphp/#post-1123842)
 * I realized I slippe an “à” in the code, so here is the good version :
 *     ```
       <!-- 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, " post in";
   
       					}else if ($category->count > 1){à
   
       					//if there is more than one post in this category
   
       					echo $category->category_count, " posts in";
   
       					}else{
   
       					//if there is no post in this category
   
       					echo "there is no post in";
   
       					}
       				} ?>
   
                       <!-- Show Category name -->
   
                       <?php single_cat_title(); ?>
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Post count for a specific category in category.php?](https://wordpress.org/support/topic/post-count-for-a-specific-category-in-categoryphp/)
 *  [mainguy](https://wordpress.org/support/users/mainguy/)
 * (@mainguy)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/post-count-for-a-specific-category-in-categoryphp/#post-1123841)
 * Hi Topneurotisk,
 * I think I found a solution for you while searching for the same answer. I used
   some tips from the codex ([http://codex.wordpress.org/Function_Reference/get_the_category](http://codex.wordpress.org/Function_Reference/get_the_category))
   and from this site : [http://jhherren.wordpress.com/2008/08/13/getting-the-number-of-posts-per-category-in-wordpress/](http://jhherren.wordpress.com/2008/08/13/getting-the-number-of-posts-per-category-in-wordpress/).
 * This can be used outside the Loop. I use it as a way to display the number of
   post in the category in archive.php.
 *     ```
       <!-- 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, " post in";
   
       					}else if ($category->count > 1){à
   
       					//if there is more than one post in this category
   
       					echo $category->category_count, " posts in";
   
       					}else{
   
       					//if there is no post in this category
   
       					echo "there is no post in";
   
       					}
       				} ?>
   
                       <!-- Show Category name -->
   
                       <?php single_cat_title(); ?>
       ```
   
 *   Forum: [Installing WordPress](https://wordpress.org/support/forum/installation/)
   
   In reply to: [WordPress hacked, tried to re-install](https://wordpress.org/support/topic/wordpress-hacked-tried-to-re-install/)
 *  Thread Starter [mainguy](https://wordpress.org/support/users/mainguy/)
 * (@mainguy)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/wordpress-hacked-tried-to-re-install/#post-1180442)
 * Ok,
 * I just saved my permalink settings and it’s working.
 * Sorry.
 *   Forum: [Installing WordPress](https://wordpress.org/support/forum/installation/)
   
   In reply to: [WordPress hacked, tried to re-install](https://wordpress.org/support/topic/wordpress-hacked-tried-to-re-install/)
 *  Thread Starter [mainguy](https://wordpress.org/support/users/mainguy/)
 * (@mainguy)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/wordpress-hacked-tried-to-re-install/#post-1180436)
 * You can visit the site here :
 * [http://www.hugofournier.com](http://www.hugofournier.com)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Hide sidebar when screen resolution is too small](https://wordpress.org/support/topic/hide-sidebar-when-screen-resolution-is-too-small/)
 *  [mainguy](https://wordpress.org/support/users/mainguy/)
 * (@mainguy)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/hide-sidebar-when-screen-resolution-is-too-small/#post-1160711)
 * I don’t know how your CSS is build, but I woud suggest a rather simple Javascript
   code that detects the screen resolution and acts consequently.
 *     ```
       <SCRIPT language="JavaScript">
       <!--
       if ((screen.width>=1024) && (screen.height>=768))
       {
        //set your sidebar DIV display to "none";
       }
       else
       {
         //set your sidebar DIV display to "block";
       }
       //-->
       </SCRIPT>
       ```
   
 * I don’t know if that can help you, but I think it can be a simple solution!
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Page of posts](https://wordpress.org/support/topic/page-of-posts-1/)
 *  Thread Starter [mainguy](https://wordpress.org/support/users/mainguy/)
 * (@mainguy)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/page-of-posts-1/#post-1124853)
 * Oh and of course I’ve added the `<?php previous_posts_link(); ?>
    <?php next_posts_link();?
   >` links.

Viewing 7 replies - 1 through 7 (of 7 total)