WordPress.org

Ready to get started?Download WordPress

Forums

Display Excerpt in single.php and link to Full Post (14 posts)

  1. freezay
    Member
    Posted 6 years ago #

    Hello,

    I'd like to ask about excerpts. Pardon my english and hope my simple detailed explanation would help. :)

    I sincerely appreciate any help contributed even if it may not solve this problem.

    Is it possible to display an Excerpt on single.php where (e.g. "Read the Full Article") would show on single.php

    When someone clicks on "Read the Full Article", it'll then take the user to the FULL post(.../title/#more-2).

    Could this be done?

    Design Structure
    I would share my design structure.

    Categories Page would display ALL the titles (without any description) of the post. (this way, i can display lots of posts on the category page, w/o having to scroll)

    e.g.

    Hello1
    Hello2
    Hello3

    As someone clicks on Hello1,

    It'll take them to single.php where the excerpt would be shown.

    e.g.

    <title>Hello1

    <excerpt>Today is hello1. Hello! Welcome to Hello1.

    <Read The Full Article..> (link to full article)

    User can then take a look at the short excerpt to decide whether or not to click on "Read the Full Article".

    Current Accomplishment:

    Able to display excerpt on single.php but the Linking of "Read the Full Article" to <...title/#more-2> does not work.

    The screen did not even refresh when i click on the link. It should give me the full summary right?

    Personal Suggestions:

    Are there codes to check if the "Read The Full Article" button is clicked? and if it's click, we display the full content?

    e.g.

    <?php if (#more) {
    the_content();
    } else {
    the_excerpt();
    } ?>

    Appreciation
    Thank you so much for reading this problem and if my explanation sucked, I would be glad to re-explain. Thanks for your time.

    Thank You.

    Regards,
    freezay

  2. shadow
    Member
    Posted 6 years ago #

    Just to make sure this is what you want, try changing <?php the_content(); ?> to <?php the_excerpt(); ?> in your single.php

    Then you can go on from there with your other ideas...

  3. freezay
    Member
    Posted 6 years ago #

    Hello shadow,

    Thanks for the quick reply.

    <?php the_excerpt() ?>

    <p>#more-<?php the_ID(); ?>" title="Read the rest of this entry">Continue Reading...</.a></p>

    These are the codes I have on single.php

    Currently:

    It shows the excerpt on the single.php and displays a "Read the Full Article" link

    However, when clicked, nothing happens. It should take me to the full article.

    Thank you shadow once again for your time :)

    Regards,
    freezay

  4. shadow
    Member
    Posted 6 years ago #

    A link would be helpful.

  5. Chris_K
    Member
    Posted 6 years ago #

    Knowing what I know about Template_Hierarchy... man... I just don't see how this could be done without some major custom coding.

    But I'll watch this topic and see if I can learn something :)

  6. shadow
    Member
    Posted 6 years ago #

    You're right HandySolo - I really should make sure I have that coffee before I tackle these things in the mornings.

    It's not going to work Freezay.

  7. freezay
    Member
    Posted 6 years ago #

    Oh,

    http://www.dailymoneyblogtips.com/2007/10/01/smoking/smoking-kills-2

    I have not implemented the design for my category page (i only want the titles)

    The main problem is with the "Read The Full Article"'s hyperlinking.

    Thank you shadow.

    Regards,
    freezay

  8. freezay
    Member
    Posted 6 years ago #

    Thanks for the replies Moderators.

    Man, that's bad news for me. :(

    Alright, i'll read up more and see what I can do, hopefully some leads to keep this topic alive.

    Thanks again.

    Regards,
    freezay

  9. Chris_K
    Member
    Posted 6 years ago #

    Just thinking out loud here...

    If I were to tackle something like this, I think I'd go with the_content instead of the_excerpt, but try to bury some anchors in the content. Then do a little javascript/ajaxy "stuff" to show/hide the more content (based on the anchor maybe?)

    Again, just thinking out loud...

  10. freezay
    Member
    Posted 6 years ago #

    Good idea. I might try that out.

    However, I thought of another way but can't seem to get it working. I am bad with PHP coding :E

    Where do I paste my codes? is there a pastebin somewhere? it's about 25 lines.

    Thanks

    freezay

  11. Chris_K
    Member
    Posted 6 years ago #

    Lots of pastebins, but we tend to use http://wordpress.pastebin.ca for most stuff.

    Toss your code there and drop a link to it here. Hopefully someone will have some feedback to offer.

  12. freezay
    Member
    Posted 6 years ago #

    Thanks for the link HandySolo.

    http://wordpress.pastebin.ca/723968

    What I tried to do basically is, getting the URL of the browser and tally with the Permalink(this is my topic url right? it'll always be ...../smoking-kills-2).

    I noticed that once I click on "Read the Full Article", my url above changes to ......smoking-kills-2/#more-22.

    Thus, I created this simple if else statement, but have no idea why it can't work.

    It keeps going to the IF statement.

    Pardon me on my novice php codings.

    Please clarify any doubts with me if i'm unclear. :)

    Thank you.

    freezay

  13. freezay
    Member
    Posted 6 years ago #

    Uh Ok,

    What I did was useless. Sorry about this.

    Will try out your suggestion sometime later :)

    Thanks HandySolo and shadow.

    freezay

  14. freezay
    Member
    Posted 6 years ago #

    Just in case there are some slight hopes to this,

    Update on pastebin: http://wordpress.pastebin.ca/723980

    edited the codes to:
    a href="<?php the_permalink() ?>#more-<?php the_ID(); ?>" title="Read the rest of this entry">Read The Full Article../a</p>

    Thanks

    freezay

Topic Closed

This topic has been closed to new replies.

About this Topic