[wp-trac] [WordPress Trac] #40079: Content of static pages does not show when you have a count_post in the theme
WordPress Trac
noreply at wordpress.org
Thu Mar 9 14:08:16 UTC 2017
#40079: Content of static pages does not show when you have a count_post in the
theme
--------------------------+-----------------------------
Reporter: devlink1337 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.7.3
Severity: normal | Keywords:
Focuses: template |
--------------------------+-----------------------------
in page.php when you have elsewhere:
{{{#!php
<?php
$count_posts = wp_count_posts();
$posts = $count_posts->publish;
$numberofcats = wp_count_terms('category');
echo "<p><u>".$posts." articles in ".$numberofcats. "
categories:</u></p>";
?>
}}}
then the content inside the loop of a static page will display the content
of an article. well for me i fixed it with:
{{{#!php
<?php $count_posts = wp_count_posts();
$numberofcats = wp_count_terms('category');
echo "<p><u>".$count_posts->publish." articles in ".$numberofcats. "
categories:</u></p>";
?>
}}}
I am testing it on a custom theme but with plain code you will see this
too.
tested it on a plain installation with custom theme in page.php:
{{{
<?php get_header(); ?>
<h2>Categories:</h2>
<?php $count_posts = wp_count_posts();
$posts = $count_posts->publish;
$numberofcats = wp_count_terms('category');
echo "<p><u>".$posts." articles in
".$numberofcats. " categories:</u></p>";
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><a href="<?php the_permalink() ?>"><?php the_title();
?></a></h2>
<div class="entry">
<?php the_content(); ?>
</div>
<?php endwhile; endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40079>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list