• Resolved dave1234

    (@dave1234)


    I’m using get_the_excerpt() to show excerpts of posts on my front page. By default, the title of each excerpt links to the full post. I want to change those title links so they go to other pages, not to the posts.

    Failing that, having the titles not be links at all would also be a possible solution.

    Any idea how can I do this? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • get_the_excerpt() returns the excerpt, not the title of the post, so the title linking to the post is called by other function. You can also use the_excerpt() to display the excerpt directly inside <p></p> tags.

    You can use the_title() to call the title of the post, and it’s not going to be a link to the post unless you href it to the_permalink().

    So you can basically make:

    <a href="[your desired link]"><?php the_title(); ?></a>
    <?php the_excerpt(); >

    Don’t have to mention it has to be inside the loop, right?

    Thread Starter dave1234

    (@dave1234)

    Thanks that helped a lot.

    For anyone looking to do a similar thing, I’ve made it so my front page only shows posts from a single category, and then, in each of the posts in that category (only 3 in my case) I have a custom field called link, which contains the relative url of the page I want the excerpt title to link to, like this:

    $customtitlelink = get_post_meta( get_the_ID(), “link”, true );
    ?>
    <h1 class=”entry-title fl-l”>” rel=”bookmark” title=”<?php the_title(); ?>”>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change excerpt title link so it goes to a custom url?’ is closed to new replies.