• Resolved D C

    (@danecarbaugh)


    Hey all. I found in my loop.php where my theme (graphene) finds the page and post title and outputs it. I want to hide my page titles, but keep my post titles. I don’t understand PHP well, so I’ll give the code below and if you could tell me how to change it to keep the Post titles in the h2 tags but print nothing if it’s a page, that would be great.

    Thanks

    <h2 class="post-title">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(esc_attr__('Permalink to %s', 'graphene'), the_title_attribute('echo=0')); ?>"><?php if (get_the_title() == '') {_e('(No title)','graphene');} if (is_home() || is_front_page() ) {/*Do nothing*/} else {the_title();} ?></a>
    <?php do_action('graphene_post_title'); ?>
    </h2>
Viewing 4 replies - 1 through 4 (of 4 total)
  • just add if(is_page()) next to is_home()

    <?php if ( !is_page() ):?>
    <h2 class="post-title">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(esc_attr__('Permalink to %s', 'graphene'), the_title_attribute('echo=0')); ?>"><?php if (get_the_title() == '') {_e('(No title)','graphene');} if (is_home() || is_front_page() ) {/*Do nothing*/} else {the_title();} ?></a>
    <?php do_action('graphene_post_title'); ?>
    </h2>
    <?php endif;?>
    Thread Starter D C

    (@danecarbaugh)

    AWESOME!!!! Thanks guys!

    Hello.
    I was wondering how to achieve the same goal in a twenty ten child theme.create a new page-loop file?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Edit PHP remove Page Titles, Keep Post Titles’ is closed to new replies.