New Topic

When viewing a single post page, make the title not a link but just text

Home › Forum › Customization › When viewing a single post page, make the title not a link but just text

This topic contains 10 replies, has 2 voices, and was last updated by  StartupWP 4 years, 6 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1846

    cochi
    Participant

    Hi,

    First of all, your theme is great, I love it.
    I have only one problem: When you click on the title of a post to read it it will open the post page with the full content of that page. Right now the title of the post page is a link to the same post, linking the page to itself. I will like to make the title to be only text on the post page.

    Thank you

    #1850

    StartupWP
    Keymaster

    If it’s simply a matter of appearance, you can use:

    .single .entry-title a {
      color: #777;
      cursor: text;
      font-size: 25px;
      text-decoration: none;
    }

    https://startupwp.com/topic/customizing-your-theme/

    Otherwise, we’ll need to dig into the code to hack the PHP.

    #1851

    cochi
    Participant

    Thank you for your quick reply but it’s not about appearance. I don’t think that you understood me. Right now the title of each post is also a link to the same post, basically the page will have a loop link. I think that when you load the full post the title should be only text, not a link.
    To understand better please take a look here. As you can see the title of the post, “The tech news of the day. 09/08/2014” is also a link to the same page. I will like to be only text.
    This is the code:
    <a href="http://www.computeronechicago.com/news-of-the-day-september-08-2014/" title="The tech news of the day. 09/08/2014" rel="bookmark">The tech news of the day. 09/08/2014</a>
    I will like to remove the anchor html tag.

    Thank you

    #1852

    cochi
    Participant

    I fixed it. For everybody who will want to do it:
    On the child theme modify the entry.php file:
    Replace
    <?php if ( is_singular() ) {echo '<h1 class="entry-title">';} else {echo '<h2 class="entry-title">';} ?><a href="<?php the_permalink(); ?>" title="<?php printf( __('Read %s', 'startup'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a><?php if ( is_singular() ) {echo '</h1>';} else {echo '</h2>';} ?>
    with
    <?php if ( is_singular() ) { echo '<h1 class="entry-title">'; } else { echo '<h2 class="entry-title">'; } ?><?php the_title(); ?><?php if ( is_singular() ) { echo '</h1>'; } else { echo '</h2>'; } ?> <?php edit_post_link(); ?>

    #1855

    StartupWP
    Keymaster

    Actually, that will disable the ability to reach the single post from archive, tag, cat and search pages, instead, use:

    <?php if ( is_singular() ) {echo '<h1 class="entry-title">';} else {echo '<h2 class="entry-title">';} ?><?php if ( !is_singular() ) {echo '<a href="' . get_permalink() . '" title="<?php printf( __('Read %s', 'startup'), the_title_attribute('echo=0') ); ?>" rel="bookmark">';}<?php the_title(); ?><?php if ( !is_singular() ) {echo '</a>';}<?php if ( is_singular() ) {echo '</h1>';} else {echo '</h2>';} ?>

    Thank you.

    #1858

    cochi
    Participant

    Hi,

    I tried your code but I’m getting the following error: “Parse error: syntax error, unexpected ‘Read’ (T_STRING), expecting ‘,’ or ‘;’ in …/wp-content/themes/startuppro-child/entry.php on line 3”

    For now I put back my code.

    Thank you.

    #1861

    StartupWP
    Keymaster

    Apologies, give this a try:

    <?php if ( is_singular() ) { echo '<h1 class="entry-title">'; } else { echo '<h2 class="entry-title">'; } ?><?php if ( !is_singular() ) { echo '<a href="' . get_permalink() . '">'; } ?><?php the_title(); ?><?php if ( !is_singular() ) { echo '</a>'; } ?><?php if ( is_singular() ) { echo '</h1>'; } else { echo '</h2>'; } ?>

    #1865

    cochi
    Participant

    Hi,

    I tried the second code but it’s not working either, I’m getting the same error message:
    “Parse error: syntax error, unexpected ‘}’, expecting ‘,’ or ‘;’ in …/wp-content/themes/startuppro-child/entry.php on line 3”

    That’s OK. For what I need I think that the solution that I found is good enough. If I will notice something not working properly I can always just delete the file from the child theme and it will use the original one from the parent theme.

    Thank you for your help.

    #1866

    StartupWP
    Keymaster

    Fixed another error in the above code if you’d like to give it a try.

    Thank you.

    #1867

    cochi
    Participant

    Yes, this time everything works just fine.

    Thank you very much for your help. You have a great theme.

    #1868

    StartupWP
    Keymaster

    Excellent.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.