0

I am a little confused.

Reading settings : 1) Front page -> Home -> Frontpage.php 2) Posts page -> News -> pages_news.php [this is custom page template :Pages Custom news ]

From Pages: 3) Pages -> News -> Edit -> Template -> Pages Custom news

My frontpage.php works but my custom page template pages_news.php from news didn't work. specifically, i customize the template with other settings or remove all and didn't work. It displays all the content. Also, I want to publish the first 6 posts (Without the sticky post) to frontpage.php and the others posts or articles to pages_news.php

6
  • from: codex.wordpress.org/Creating_a_Static_Front_Page - Do not use a custom Page template for this page! home.php or index.php will be used to generate this page.
    – Michael
    Jan 13, 2013 at 15:47
  • Which template do the stuff instead of your pages_news? Also check your template for heading: <?php /* Template Name: News Page */
    – Max Yudin
    Jan 13, 2013 at 15:47
  • @Michael my frontpage.php works For this page i don't use custom page template, but only for news. Max Yudin, what exactly you mean? The template name have checked correctly.
    – user24259
    Jan 13, 2013 at 15:51
  • With some changes i realized that the custom page template gets the content from index.php. why this happens;
    – user24259
    Jan 13, 2013 at 16:13
  • What i am doing wrong? I spend many hours to find the solution. The curious is that the page news is not loaded from the custom page template but only from index.php.
    – user24259
    Jan 13, 2013 at 16:36

1 Answer 1

1

When you make a page the page for posts, it is no longer a page in the conventional sense, so it won't load your custom page template. See the Template Hierarchy to learn how WordPress selects a template based on the requested page.

This behavior also extends to Conditional Tags. is_page() will return false on the page selected as page for posts, while is_home() will return true.

Rename your pages_news.php to home.php, no need to select it as the template (as we have seen, it is ignored anyway).

3
  • First of all many thanks for the responses and the conversation that we have. I read the template Hierarchy. I think that this question have so many solutions. The first is that described by @Milo, the second is that i do: I disable from reading settings the post page as default. Then, create a custom page template with name : pages_custom_news.php. And works. I did the right thing; With this solution have i any problems? The 3rd thing that i want to question is How can i publish only the first 6 posts to frontpage.php and the others posts to my custom page template? Thanks again
    – user24259
    Jan 13, 2013 at 17:09
  • I need two static pages. One for home.php and another one for news.php s. In the home.php i wll enable/publish only the first 6 posts and for news.php the remaining articles 7 and under.
    – user24259
    Jan 13, 2013 at 18:09
  • Comment or Answer my question? I am not sure so i write a comment, but i want your feedback. After many efforts i do that: First i create a frontpage.php, then for reading options i enable front page and set as default the post page, also i create a custom page template for news. In frontpage posted the first 6 posts/articles and in news posted the remaining posts. So far I have no problem. I want to read your feedback. Thanks in advance.
    – user24259
    Jan 13, 2013 at 22:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.