• I would love to be able to control the “read more” link for individual posts. Such as “See photos”, “watch video” and anything else to describe what is beyond the fold.

    is this possible?

    Thanks!!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Might consider using a Custom Field for each post that dictates what ‘read more’ link would be used then make changes to your template (e.g. index.php) to use a different values for ‘more_link_text’ when using the_content.

    Something along these lines but of course changing the code to recognize your situation:
    https://www.flisterz.com/2008/06/07/wordpress-conditional-statement-using-custom-fields/

    Thread Starter alittle116

    (@alittle116)

    Thanks, Michael. I tried following the tutorial you linked but am having difficulty.

    This is the code in my template currently:

    <?php the_content('<span class="more-link">'.__('Read More &raquo;', 'sandbox').'</span>'); ?>

    And I have created a custom field with the key “Read More”.

    Can you advise me?

    Thanks!

    Assuming Custom Fileld values of video or photo, try this untest code:

    <?php $rmtype = get_post_meta($post->ID, 'Read More', $single = true);
    if($rmtype === video ) {
    $rmtext = 'See the video &raquo;';
    }
    elseif ($rmtype === photo ) {
    $rmtext = 'View the photos &raquo;';
    }
    else {
    $rmtext = 'Read the rest of this entry &raquo;';
    }
    the_content('<span class="more-link">'.__($rmtext, 'sandbox').'</span>');
    ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Customizing “Read More” link on a post-by-post basis’ is closed to new replies.