开发者

Wordpress Post Text Excerpt in Sidebar?

I am curious if there is a way to output an excerpt of the post txt into a sidebar, but only the sidebar for that post.

What I have tried is using the get_content loop in the single.php into a custom sibar that I have created inside another DIV, but it displays the post txt, Comments and images in the sidebar.

 <div id="Sidebar">
   &l开发者_C百科t;?php the_content(); ?>
 </div>

Question: Is there anyway to display Post text in the sidebar?


You could do this:

<div id="sidebar">
    <?php 
       the_content();

       //display only on post page 
       if(is_single()){
          the_excerpt();           
       }
</div>

Hope that works!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜