2015-07-20 94 views
0

我想为我的Wordpress网站添加一个计数器。每篇文章都有一个ID,但它往往是一个很长的随机数字。我希望每个帖子上有一个1,2,3,4 ...可以在标题/段落旁显示。在Wordpress帖子中添加一个唯一的帖子编号

HTML - single.php中

get_header(); ?> 

    <main role="main"> 

     <?php while (have_posts()) : the_post(); ?> 

     <?php get_template_part('content', 'single'); ?> 
     <?php bnNav_content_nav('nav-below'); ?> 

     <?php endwhile; // end of the loop. ?> 

    </main> 

<?php get_footer(); ?> 

HTML内容单一

<div id="post-<?php the_ID(); ?>" class="post-content"> 

    <div class="row post-text-wrap"> 

    <div class="counter"> *** counter number here *** </div>  

     <h1><?php the_title(); ?></h1> 

     ... 

不知道从哪里开始实现这个

编辑

通过计数器我的意思是的第一个帖子会显示1,第二个帖子会显示2,等等(帖子ID不输出t等简单的数字)

我会把它想输出到如下所示

1 /文章标题

文本....

+0

莫非你更多地解释什么柜台应该准确计数?它从这个问题不清楚, – BenB

回答

相关问题