• scottiescotsman

    (@scottiescotsman)


    I have just recently removed all the page headers through .php but now all my post headers are gone also and cant figure how to put then back on.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Topher

    (@topher1kenobe)

    That’s because pages and posts used the same template. Start by putting back what you took out.

    Next, in your template, we want to figure out if we’re displaying a post or page. You can do that with this code:

    <?php
        $post_type = get_post_type( get_the_ID() );
    ?>

    Then, there the title is being printed, do something like this:

    <?php
    if ( 'post' == $post_type ) {
        // do whatever to print your headers
    }
    ?>

    The above will make headers appear ONLY on posts.

    Thread Starter scottiescotsman

    (@scottiescotsman)

    ok got all headers back and everything is good … only thing missing in my code is in the the recent posts widget when I click it that post has no header grr… 99% done

    ps thanks for your help.. not bad for a newbie like me lol

    go to https://www.scottiescotsman.com and see what I mean

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘post header missing’ is closed to new replies.