• Resolved sonic1243

    (@sonic1243)


    Afternoon .. I need a little help with some php.

    I’m trying to remove the link from titles on singular post pages, I understand how to do it; but the php formatting breaks.

    Currently I have:
    <?php if ( is_singular() ) { echo '<h1 class="entry-title">'; } else { echo '<h2 class="entry-title">'; } ?><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a><?php if ( is_singular() ) { echo '</h1>'; } else { echo '</h2>'; } ?>

    I tried moving the anchor to within the non-singular, but I realise you can’t echo within an echo, so this attempt is broken:
    <?php if ( is_singular() ) { echo '<h1 class="entry-title">'; } else { echo '<a href="<?php the_permalink(); ?><h2 class="entry-title">'; } ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?><?php if ( is_singular() ) { echo '</h1>'; } else { echo '</a></h2>'; } ?>

    Could somebody help me solve this please?
    Thanks…

Viewing 2 replies - 1 through 2 (of 2 total)
  • example:

    <?php if ( is_singular() ) { echo '<h1 class="entry-title">'; the_title(); echo '</h1>'; } else { ?><h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a></h2><?php } ?>

    Thread Starter sonic1243

    (@sonic1243)

    That’s the one, you are a star, thanks for your time alchymyth : )

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove link from singular post titles’ is closed to new replies.