• Resolved michaelware1205

    (@michaelware1205)


    Totally stumped by this one.

    I’m developing a journal website via localhost with pages, posts and a few custom post types. I used twentysixteen as a blueprint and turned it into a custom theme. Posts are displaying correctly, but my pages ignore both pages.php and template-cat-landing.php in the usual template hierarchy and instead use index.php (and home.php until I renamed it homexxx.php). When I view a page after editing, I don’t see the_content() from that page, I see the_content() from all blog posts instead.

    I’ve deactivated all plugins and stripped out almost everything from functions.php but nothing seems to work. The front page and blog page are assigned in Settings. I’ve searched the internet high and low but have not found anyone with a similar problem.

    Has anyone ever encountered this?

    My ugly options are 1) recreating the theme from scratch or 2) ??

    Any feedback would be appreciated.

    Michael

Viewing 6 replies - 1 through 6 (of 6 total)
  • Is the site public? Is there a link where we can see it?

    Ah no. You said localhost.

    What are the names of the pages you are trying to use? Does the page title match the filename?

    • This reply was modified 7 years, 11 months ago by Julie Kuehl.
    Thread Starter michaelware1205

    (@michaelware1205)

    I’m selecting the page template in the admin, not relying on page names. My template-cat-landing.php is available when editing the page, but not used to render the page.

    Well, template-cat-landing.php isn’t going to be recognized by the template hierarchy. If you’re trying to get a listing of all posts within a category, you’ll need to work with the category.php file. And pages.php isn’t recognized either, but page.php is. If you create files with those names, does your theme show the content then?

    Thread Starter michaelware1205

    (@michaelware1205)

    Good points @juliekuehl.

    I am using page.php, not pages.php, but misspelled in this thread. I didn’t think I could use category.php since I’m using a page, not a post to create the content. What I assumed was that WordPress’ template hierarchy would mean that template-cat-landing.php would be used before index.php OR that me selecting the page template in the admin > page attributes section would guarantee the use of that template. It did not.

    In the end, I had to copy the entire theme, rename it and use this new version. I’m not sure why but that worked.

    Thanks for your input. I appreciate it.

    I’m glad you got it sorted out!

    Thread Starter michaelware1205

    (@michaelware1205)

    The problem turned out to be a faulty custom taxonomy plugin that I copied and pasted from a previous project. Once that was recreated using https://generatewp.com/, everything worked as expected.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Pages ignoring template files, always use index.php’ is closed to new replies.