开发者

Using the content of a Wordpress page elsewhere in the Wordpress template

Hello I would like to use the content of a number of Wordpress pages in different areas of my template. As an example, the content of the about page being output into the sidebar.

Now I know that I can use the loop with a new query to query just that specific page. But am wondering if there is a simpler method of doing 开发者_JAVA百科that, that doesn't require me to reset my previous query.

Thanks in advance.


<div id="widget"> <?php echo substr(get_post($page_id)->post_content, 0, 50); ?> </div>

You could add something like this into your sidebar (within your theme folder). Replace $page_id with the ID of your About page.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜