WordPress.org

Ready to get started?Download WordPress

Forums

Can I disable post titles' clickable URL's, but keep permalinks? (3 posts)

  1. thursfrisat
    Member
    Posted 6 years ago #

    The post titles at my blogs (Angies List podcast and TFS are clickable, but I don't want them to be. Do you know how to disable clickable post titles in WordPress/K2? My PHP knowledge is limited, so I don't want to go mucking around without knowing for sure how to disable these.

    I would, however, like to keep the permalinks; just not have the titles for the posts be clickable to the permalinks. E.g. if you're at angieslistpodcasts.com/episode 1, and you click on the title, it would go to the same page, angieslistpodcasts.com/episode 1. I just want to disable clickable titles without ruining permalink URL's. Hope I've made sense :P Thanks!

  2. AccurateWeb
    Member
    Posted 6 years ago #

    Here's what I did:

    I found the anchor tag that makes the post title a hyperlink.

    Then I inserted some conditional code to tell the page not to show the title as a link if it has anything to do with category "frontpage". (Notice the "if" and "endif" statements.)

    This, effectively, turns off the title link on my front page, leaving the titles and permalinks on my other pages/posts alone.

    <h2>
        <? if (single_cat_title("", false)!="frontpage"):?>
           <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
        <? endif;?>
          <?php the_title(); ?>
        <? if (single_cat_title("", false)!="frontpage"):?>
           </a>
        <? endif;?>
    </h2>

    You can see it in effect on http:/www.outdooradvantageonline.com

  3. Kafkaesqui

    Posted 6 years ago #

    Why not just:

    <h2><?php if( is_single() ) : ?>
    <?php the_title(); ?>
    <?php else : ?>
    <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    <?php endif; ?></h2>

    Reference:
    http://codex.wordpress.org/Conditional_tags#A_Single_Post_Page

Topic Closed

This topic has been closed to new replies.

About this Topic