WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] how do I change my post's title h2 in my index.php (7 posts)

  1. pgb
    Member
    Posted 6 years ago #

    I have my own template and am using my blog page as a news or information page. I have set the post's title as News but it is underlined and blue as it is a link. I don't want the underlined link to be there or indeed it to be a link. I can't find a way to edit it.

    In the code for my index.php I have
    <h2>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>

    I haven't studied php, but is the simplest way to lose the blue and link, to delete this part of the php and have my own h2, or is there a better way?

  2. Ivovic
    Member
    Posted 6 years ago #

    please use the code button when pasting code, so we can see what you've actually got there, instead of this mishmash.

    what you really need to remove is the:

    <a href="some stuff here" rel="more stuff" title="blah blah"> . . . </a>

    part.

    basically, pay close attention to the angled brackets and remove only that which I've shown here. Everything signified by the dots should stay, so text between the open A and the closed /A should stay, but the anchor tag itself should go.

  3. pgb
    Member
    Posted 6 years ago #

    Apologies for the code, I'm new to this. I hope the code is below now.

    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>

    Could I check with you what should go as I don't quite understand what you mean. Thanks.

  4. Ivovic
    Member
    Posted 6 years ago #

    try turning what you've posted into this:

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

    and see how you go.

    It is possible to remove the underline and change the colour of your heading links, if you did actually want them to remain links... but as you've stated, if you don't want them to be links at all, this is how to do it.

  5. pgb
    Member
    Posted 6 years ago #

    Just to add to my confusion are there too many double quotation marks in the code above and is this what it should look like?....

    <h2><?php the_permalink() ?> rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>

    As you have advised, I have kept the text between the open and closed A /A and have deleted the anchor tag itself but it does not work. I'm not sure what you mean by everything signified by the dots should stay when the dots come after some text which I think should stay.

    I'd be grateful if you could clarify this please.

  6. Ivovic
    Member
    Posted 6 years ago #

    well, then maybe you're wrong :) or at least you're not making it clear whether you do indeed want to remove the link or not.

    I did post an example above...

    if you don't want it to be a link, keeping all these things with the word LINK in them seem like a bad idea:

    <?php the_permalink() ?> rel="bookmark" title="Permanent Link to <?php the_title(); ?>">

    by the way, life will be simpler for you if you use the code button on the posting toolbar above where you're typing your posts, to insert backticks around your code snippits.

    This is just one of those hurdles you've got to get over with customizing your blog... a little HTML goes a long way. For some it comes more easily with a book, but unless you've been at this for a solid week and still haven't got the hang of it, I'd say a book probably isn't necessary.

  7. pgb
    Member
    Posted 6 years ago #

    I've only just seen your reply try turning what you've posted into this:. This does indeed work, many thanks for your expert knowledge.

Topic Closed

This topic has been closed to new replies.

About this Topic