WordPress.org

Forums

[resolved] Remove hyperlink from post title won't work. (6 posts)

  1. jmadz1
    Member
    Posted 4 years ago #

    I have these lines in my single.php document.

    <div class="post">
    
    <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>

    I tried removing the <a> tags and the permalink section so it looked like this:

    <h2><?php the_title(); ?></h2>

    but my page still shows it as a hyperlink. How can this be? Yes I have saved the changes and I've tried multiple times with slightly different variations of <h2><?php the_title(); ?></h2> but to no avail.

    Does anyone know if there is something overriding the changes I'm making, or if I'm just doing it wrong? Thanks.

  2. If you don't want the link, <h2><?php the_title(); ?></h2> is correct. Did you empty your cache?

    Also, check your theme to make sure that's the page it's calling for your single post.

  3. jmadz1
    Member
    Posted 4 years ago #

    I went through all of my php files and 5 of them had the code title code with the permalink and <a> tags included.

    archives.php
    index.php
    page.php
    search.php
    single.php

    I changed the code in each one to and then saved changes, then cleared my cache. I went back on my website and there is still a hyperlink for the post title.

    Very anoying how things aren't as straight forward as everyone makes out. I've searched the internet for answers but everyone gives the same advice 'just change it to <h2><?php the_title(); ?></h2>', that's all you have to do.

    Do you know anything else that might be affecting this?

  4. kmessinger
    Forum Moderator
    Posted 4 years ago #

    URL?

  5. jmadz1
    Member
    Posted 4 years ago #

    http://www.pullupbarsx.com/

    I've noticed that now it's actually worked on all my pages except for "Which Pull Up Bar?" which still remains a hyperlink, even though I've cleared my cache.

  6. FYI, you need to put CODE tags around <a> on the forums to stop goobering your posts ;)

    "Which Pull Up Bar?" - http://www.pullupbarsx.com/home-2/ has no title link for me.

Topic Closed

This topic has been closed to new replies.

About this Topic