WordPress.org

Ready to get started?Download WordPress

Forums

Child pages loading parent data, not its own (9 posts)

  1. afreak
    Member
    Posted 4 years ago #

    I have created the following page:
    http://keyboardcowboy.ca/photos/

    And then I created a few child pages:
    http://keyboardcowboy.ca/photos/2007/
    http://keyboardcowboy.ca/photos/2008/
    http://keyboardcowboy.ca/photos/2009/

    When you load the child pages, the parent is loaded instead of itself. What is the configuration 'hiccup' I have managed to create here?

    I can provide any further information if needed. :)

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Try resetting your custom permalinks to the default setting and see if that works first.

  3. afreak
    Member
    Posted 4 years ago #

    esmi, I have no problems pulling up the pages via their IDs. The permalinks used are the defaults available out of the box.

  4. Mark / t31os
    Moderator
    Posted 4 years ago #

    Then it'll most likely be a problem with the template file that handles the display for those pages, which you can easily confirm by switching to another theme and checking the page(s).

  5. afreak
    Member
    Posted 4 years ago #

    @t31os_ I gave your idea a try and it seems to be creating the same problem for me. It's starting to look like more a config issue than a template issue.

  6. afreak
    Member
    Posted 4 years ago #

    Three months later and I am still running into the problem. This is the rewrite rule as we speak:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
  7. Mark / t31os
    Moderator
    Posted 4 years ago #

    Probably a custom query screwing with the data..

    If you have a page template attached to this problematic page
    1. Open the page template file.
    If you don't have a page template attached
    1. Open your theme's page.php

    2. Find a line that starts like this.

    query_posts(

    or alternatively (only if above not found)

    while( have_posts() ) : the_post();

    3. Add this code before the above code.

    wp_reset_query();

    4. Appropriate code should now look like this.

    wp_reset_query();
    query_posts( ..etc..

    or

    wp_reset_query();
    while( have_posts() ) : the_post();

    5. Try your page.

    Failing that, i'll need to see the template file responsible for displaying those page, if necessary, please post code into a pastebin.

  8. afreak
    Member
    Posted 4 years ago #

    http://pastebin.ca/1874532
    Here's the code. I gave your suggestion a try and it doesn't appear to be make much of a difference.

    The one thing that is being overlooked, however is that switching templates doesn't appear to solve the problem. I switched to the WordPress Default theme and it didn't make any difference.

  9. Mark / t31os
    Moderator
    Posted 4 years ago #

    Then the query could be getting modified by a filter / action from a plugin, disable your plugins and see if the problem goes away.

    Failing that, i'd ask if you have any custom queries in the header (not that it should matter, you have a reset in your file already).

Topic Closed

This topic has been closed to new replies.

About this Topic