WordPress.org

Ready to get started?Download WordPress

Forums

Site breaks when "Reading" settings are changed (20 posts)

  1. TheBrandon
    Member
    Posted 3 years ago #

    Hello all,

    I know this is a problem with my template but I want to learn why its happening and how to fix it.

    Here is a pastebin of my index file:
    http://wordpress.pastebin.com/dwxTZ7YB

    I have a "Home" and a "Blog" page. I want my homepage to display my "Home" page and all of my posts to appear on my "Blog" page. When I assign this under Reading Settings, the site breaks and Safari says it is an infinite loop issue.

    What in my template is breaking it, or what do I need to add? I have a feeling it's a problem with the loop but it looks the same as the loop example on the WordPress Documentation.

    Any advice on how to fix it?

  2. esmi
    Forum Moderator
    Posted 3 years ago #

  3. TheBrandon
    Member
    Posted 3 years ago #

    Can you be more specific about what on my site isn't working? I'm not sure what I'm looking for.

    Did you look at my pastebin?

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    At this stage, it's not about template files. Did you follow the instructions in Creating_a_Static_Front_Page?

  5. TheBrandon
    Member
    Posted 3 years ago #

    I read over it and I feel I have done those things, yeah.

  6. esmi
    Forum Moderator
    Posted 3 years ago #

    In that case, your Home page will be using either front-page.php, page.php or any custom page template that you might have assigned to it. Your Blog page will be using the index.php template file.

    Try resetting your custom permalinks back to the default setting. If this works, then review Using_Permalinks before setting a custom permalink structure back up again.

  7. TheBrandon
    Member
    Posted 3 years ago #

    Okay so if I haven't made a page.php file, that's why it's breaking eh?

  8. esmi
    Forum Moderator
    Posted 3 years ago #

    Yep - that would cause some problems.

  9. TheBrandon
    Member
    Posted 3 years ago #

    Alright thanks, esmi. I will give it a shot. So when it is set to use a specific page for the homepage, WordPress uses the page.php file for that logic?

    I always thought page.php was a way of displaying pages one at a time and it was optional. It would start with index.php and if page.php exists, it would use that. Otherwise it would use index.php

    Is my logic wrong there? I'd like to understand how the framework works as best as I can since I use WordPress a lot and since you're a Theme Diva, I'm sure you can provide some insight. =)

  10. esmi
    Forum Moderator
    Posted 3 years ago #

    WordPress uses the page.php file for that logic?

    As with other template files, there's a logical order of files that WP looks for (aka theme hierarchy):

    front-page.php -> assigned custom template -> page.php -> index.php (the absolute fallback)

    The first in the list that's available is used. Some themes can have a home.php template file but I usually advise against that in preference to front-page.php as I have known the file name home.php cause confusion and problems in some situations.

    The thing that you have to bear in mind is that WP started off as a pure blogging tool with no static Pages. So when Pages were introduced, they had to fit into the pre-existing system. Initially, you could cope with a single index.php file but as that single template file became more & more complex with different displays for Archives, Posts and Pages, it became obvious that a wider range of template files was needed. So the theme hierarchy was developed with different templates being used for different display types.

    There's a summary of the different template files in Theme_Development that you might find useful.

  11. TheBrandon
    Member
    Posted 3 years ago #

    Thank you very much, esmi.

  12. esmi
    Forum Moderator
    Posted 3 years ago #

    No problem :-)

  13. TheBrandon
    Member
    Posted 3 years ago #

    Do you have any other recommended reading for theme development?

    I have programmed about 20-30 themes so far but I am just now getting my feet wet in the more advanced side of the WordPress theme development.

    I'm really struggling a bit with some of the more dynamic things. For example, I have a static menu made of images in HTML and I want to let wordpress manage the drop down of it. Basically just an unordered list of links but the trick is it has to have logic for each button saying "If this page has children, display links" you know?

    Luckily WordPress is incredibly documented and it seems any idea I have or problem I run into, someone has done it before and posted about it online which is one reason I love WordPress.

    Do you have any other resources you use for tricks like that or just the WordPress documentation?

  14. esmi
    Forum Moderator
    Posted 3 years ago #

    Personally I tend to use the Codex. I do run Google searches every now and then when the Codex doesn't have what I need but tend to end up on either http://ottopress.com or http://justintadlock.com If all fails, I start diving into the core itself to see what functions I can usefully re-use.

    For the example you describe, something like:

    $children = wp_list_pages('title_li=&child_of='.$this_page->ID.'&echo=0');
    if( $children ) {
    	$pagelist .= '<li class="current_page_item"><a href="'.  get_page_link($this_page->ID) .'">' . $this_page->post_title . '</a>';
    	$pagelist .= '<ul class="sub-menu">' . $children . '</ul>';
    	$pagelist .= '</li>';
    }

    might work.

  15. TheBrandon
    Member
    Posted 3 years ago #

    I'll give that a shot. I'm straying a bit off topic now. Is it okay if I email you sometime to discuss theory or strategy? I'd love to learn these things better.

  16. esmi
    Forum Moderator
    Posted 3 years ago #

    Hanging around the forums is the best place to learn. Whether I manage to answer emails depends upon how busy I am and whether the paid work has to take priority. :-)

  17. TheBrandon
    Member
    Posted 3 years ago #

    Okay so I made a page.php file and it still breaks. Even if I set the permalinks to default or have the setting as described in the static front page link you gave me.

    I even used the page.php from the default WordPress theme.

    Any ideas?

  18. esmi
    Forum Moderator
    Posted 3 years ago #

    That would depend upon what you mean by "breaks".

  19. TheBrandon
    Member
    Posted 3 years ago #

    Safari kicks back an infinite loop error.

  20. esmi
    Forum Moderator
    Posted 3 years ago #

    Do you get the same problem with Twenty Ten?

Topic Closed

This topic has been closed to new replies.

About this Topic