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 /文章標題
文本....
莫非你更多地解釋什麼櫃檯應該準確計數?它從這個問題不清楚, – BenB