• 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:
    https://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?

Viewing 15 replies - 1 through 15 (of 19 total)
  • Thread Starter thebrandon

    (@thebrandon)

    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?

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

    Thread Starter thebrandon

    (@thebrandon)

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

    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.

    Thread Starter thebrandon

    (@thebrandon)

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

    Yep – that would cause some problems.

    Thread Starter thebrandon

    (@thebrandon)

    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. =)

    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.

    Thread Starter thebrandon

    (@thebrandon)

    Thank you very much, esmi.

    No problem ??

    Thread Starter thebrandon

    (@thebrandon)

    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?

    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 https://ottopress.com or https://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.

    Thread Starter thebrandon

    (@thebrandon)

    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.

    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. ??

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Site breaks when "Reading" settings are changed’ is closed to new replies.