admin管理员组文章数量:1398761
I am trying to figure out what is the best practice to allow a customizable static page to show on the top of the dynamic front home page. What I am asking is not using a custom page a such as front-page.php because I would like to setup "Front page displays - Your latest posts" in the Wordpress > Settings > Reading section and the dynamic page to be the front page. What is the way to add some javascript to functions.php or index.php or any other file to load a custom page before the dynamic page so the both pages will show on the home page. I have done it a long time ago and do not remember any more. This is the website I did it for . The reason I am trying to do it that way is because I am trying to use the templates for the blog style from the theme I am using and do not want to just add the blog section and try to customize. Thank you.
I am trying to figure out what is the best practice to allow a customizable static page to show on the top of the dynamic front home page. What I am asking is not using a custom page a such as front-page.php because I would like to setup "Front page displays - Your latest posts" in the Wordpress > Settings > Reading section and the dynamic page to be the front page. What is the way to add some javascript to functions.php or index.php or any other file to load a custom page before the dynamic page so the both pages will show on the home page. I have done it a long time ago and do not remember any more. This is the website I did it for http://superforma. The reason I am trying to do it that way is because I am trying to use the templates for the blog style from the theme I am using and do not want to just add the blog section and try to customize. Thank you.
Share Improve this question asked Feb 4, 2017 at 16:27 Svetlozar PopovSvetlozar Popov 112 bronze badges1 Answer
Reset to default 1You will need to edit your front-page template and before (or after) your loop, you need to make a call to get_post()
so load your custom page. See the documentation for details.
You can then render your customisable page on the homepage.
For example, if your special page ID is 42:
<?php
$custom_page = get_post(42);
echo apply_filters('the_content', $custom_page->post_content);
?>
本文标签: homepageAllow a static page to show on a dynamic home blog page before the posts
版权声明:本文标题:homepage - Allow a static page to show on a dynamic home blog page before the posts 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744731986a2622101.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论