• I interested in setting a code that will enable me to do the following.
    1. Display full post if no excerpt is filled in.
    2. Display excerpt when it is filled in and have link so that when one clicks on the excerpt it takes you to the full post.

    I have already searched the whole forum but could not find a solution. I did come across this

    <?php
    if(!$post->post_excerpt) {
    the_content();
    } else {
    echo "<b>".$post->post_excerpt."</b>";
    }

    But it falls short as I noticed it not possible to insert a link to the full post.

    I ideally I will know how insert the code below into the one above, so that when the excerpt is displayed, I can click on it to see the full post (the whole excerpt has be to clickable, not just having a link to the full post).

    <pre>

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

    </pre>

    I hope I explained that well.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Here’s the two code snippets merged together:

    <?php
    if(!$post->post_excerpt) {
    the_content();
    } else {
    ?>
    <strong>
    <a rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_excerpt(); ?></a>
    </strong>
    <?php
    }
    ?>

    That helped me do part of what I want (I’m not the original poster) but I can’t figure out the next part. I tweaked it a bit so that the whole excerpt isn’t the link – just the words “read more…” but when I click on the link the post page only shows the excerpt.

    Is it possible to have only the excerpt show up on the home page but the excerpt and post on the post page?

    (I hope that makes sense – it seems to be a logical and common way to use an excerpt.)

    Here’s my code:

    <?php
    if(!$post->post_excerpt) {
    the_content();
    } else {
    ?>

    <?php the_excerpt(); ?>

    ” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>there is more…

    <?php
    }
    ?>

    The site is https://foolcrow.com

    Hi,
    I’m a real newbie to PHP and blogging and CMS!!

    My first testsite is at https://www.uttoxeter.biz/testsite/

    I would like to have an excerpt of the latest article in each category on my ‘static’ home page. Then a link to the article in full.

    I’m guessing that this is what this does, but I’d need to add the category id to the script above and have no idea how to do it.

    Example: Under the People & Politics heading, I’d like an excerpt (or first few lines of the post / summary?) of the latest post and link to full article. I’d also like to put a list of links to maybe 5 of the previous articles in the the category using the article title as the link.

    I want to do this for each of the categories.

    Is this possible? Or do I need to use some sort of RSS trick?

    Cheers,

    Tracy

    Most of what you want can be done – though you’d be better off starting your own topic and not hijacking this one. Your problem is not a clickable excerpt but a different homepage.
    You can start with this topic:
    https://www.ads-software.com/support/topic/38046
    it will help you to group the posts on the main page by categories.

    As a side note: what you say on of of your Pages with the same title as one of the categories – simply is not true. Posts will not go to that Page. (please, read the Pages link!)

    Hi,
    Thanks for the link. I didn’t mean to hijack this post. It seemed to be talking about what I wanted to do. Ie include an excerpt or summary of the latest post.

    Secondly, my comment about the pages having the same names as the categories was a question, not a statement. Sorry if that wasn’t clear.

    I will start a new thread for this as I’m really keen to get this working. I’ve now got the list of 5 latest posts to that category listed on my ‘home.php’ (thanks to your link). So, I’m half way there.

    Thanks.

    Tracy

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Clickable Excerpt’ is closed to new replies.