WordPress.org

Ready to get started?Download WordPress

Forums

Read more - customized per post (8 posts)

  1. unbeliever
    Member
    Posted 8 years ago #

    What’s I’m looking for is a simple way to change the read more link depending on the post.

    Ie:

    Post 1
    Bla bla bla bla
    Find out why unbeliever get murdered with an axe tonight!

    Post 2
    Bla bla bal bal
    Read more

    Post 3
    Bla bla bla bla
    Tantalizing isn’t it, read the rest

    And so and so forth

    Is there an easy way to go about this?

    Ta in advance

  2. whooami
    Member
    Posted 8 years ago #

    sure.. use a random array, insert the array into the function that takes care of the read more link.

    not sure its an easy thing to do, but it could certainly be done.

    Ive actually seen something like this on a movable type blog.

  3. Kafkaesqui

    Posted 8 years ago #

    You want it truly random, or *more* something you assign to each?

    For the latter you can use custom fields. Just add one to a post with a key of 'more' and whatever you want for your more text as the value. Then replace the_content() template tag in your template(s) with:

    <?php
    $my_more = $post_meta_cache[$post->ID]['more'][0];
    if(empty($my_more)) { $my_more = 'Read more'; }
    the_content($my_more);
    ?>

    This collects the post custom field data for a post and assigns the 'more' custom field (if it exists) to $my_more. Then it verifies there's something in $my_more, and if not sets a default text ('Read more'). Finally it passes $my_more as your more text.

    A little hacky, but should work.

  4. unbeliever
    Member
    Posted 8 years ago #

    simple and works like a charm! thanks

  5. davidchait
    Member
    Posted 8 years ago #

    kaf, that's just asking for a plugin to be made from it! ;)

  6. Samuel B
    moderator
    Posted 8 years ago #

    kaf, that's just asking for a plugin to be made from it! ;)

    No doubt - I think it might be a real hit - spice things up a slight bit. :>)

  7. Kafkaesqui

    Posted 8 years ago #

  8. EastVanEsica
    Member
    Posted 8 years ago #

    Ok... that is very cool idea and then to have actually made into a plugin. :)

    I'll have to give it a try. All I have right now is "continue reading this entry..."

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags