开发者

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

开发者 https://www.devze.com 2023-03-03 04:44 出处:网络
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.

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

精彩评论

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