mainguy
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Post count for a specific category in category.php?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
In reply to: Post count for a specific category in category.php?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
In reply to: Post count for a specific category in category.php?Hi Topneurotisk,
I think I found a solution for you while searching for the same answer. I used some tips from the codex (https://codex.www.ads-software.com/Function_Reference/get_the_category) and from this site : https://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
In reply to: WordPress hacked, tried to re-installOk,
I just saved my permalink settings and it’s working.
Sorry.
Forum: Installing WordPress
In reply to: WordPress hacked, tried to re-installYou can visit the site here :
Forum: Plugins
In reply to: Hide sidebar when screen resolution is too smallI 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
In reply to: Page of postsOh and of course I’ve added the `<?php previous_posts_link(); ?>
<?php next_posts_link(); ?>` links.