Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Issue with Chris' lynda.com tutorial "Starting with a blank theme template"

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #173156
    nathan.sabo
    Participant

    I followed Chris’ greate tutorial & it was a tremendous help, but I do have one issue that I haven’t been able to figure out: the older entries link doesn’t link to the older entries (we display 5 posts per page), it simply refreshes the page.

    I’ve posted a question about this along with the code on the WordPress support forum & the moderator said there were issues with the code: “That code has all kinds of issues including:

    I would greatly appreciate any insights you might have that could resolve the issue. Thanks again for all of your help!

    Nathan Sabo
    http://blog.contactdd.com/

    #173157
    Paulie_D
    Member

    Think that’s quite an old tutorial based on and 4 year old version of WordPress

    I imagine a lot of things have changed in the past 4 years.

    #173211
    JacobPeters
    Participant

    At least keeping up with WordPress’ best coding practices aren’t as bad as keeping up with graphics APIs. Things change rapidly on an actively developed platform, but part of the learning process is keeping up with those changes. I highly recommend looking through the Underscore.me theme to see what good practices are for current theme development.

    With that said, I’ll give my best shot at answering your list.

    using an internally defined variable that should only be used by core file (TEMPLATEPATH)

    This one is simple. You don’t need TEMPLATEPATH. If your page template is in the theme’s root directory, your current working directory is already the TEMPLATEPATH. All you need to do is replace this
    <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
    to
    <?php include ('./inc/meta.php' );?>
    Problem solved.`

    <blockquote>
    using query_posts() instead of pre_get_posts().
    </blockquote>

    This one is a little more complicated, so I won’t take the time to give you code. However, I will give you a push in the right direction.

    Relevant WordPress Codex Page

    That goes in your functions.php not your page template. It should give you a good idea about how to use that action hook to do what you want. If you can’t figure how to make it work in exactly the way you want it to, a quick google search should locate any additional information you need.

    <blockquote>
    using include instead of get_template_part()
    </blockquote>

    Well, you can disregard the first problem. If you fix this, it will clear that up too.

    Luckily, this is also a very easy problem to solve.

    Change

    <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
    <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>

    to

    <?php get_template_part('inc/meta') ?>
    <?php get_template_part('inc/nav' ); ?>

    The reason for this change is the ability to use child themes. Look into the Codex if you want to know more.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.