Support » Plugin: Post Content Shortcodes » "Read more" link missing

  • I’m using the following shortcode and it works great only that the “Read more” link is missing. All the posts in this set are longer than 50 words. [post-list orderby=rand numberposts=8 category=91 show_excerpt=true excerpt_length=50 post_type=post show_image=true image_width=100 image_height=100]

    On a related note: I’d actually like to have the “Read more” link show up even if a post is shorter than 50 words. Is this possible?

    Thanks,
    Jay.

    http://wordpress.org/extend/plugins/post-content-shortcodes/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Seems the plugin developer hasn’t addressed this concern yet. I found a way around it with a bit of coding. You will need to edit the class-post-content-shortcodes.php file (Plugins->Editor->). Add the following after line 350 (the line that starts with

    $output .= ‘<div class=”pcs-excerpt”>’…

    Add this after the above line

    $output .= '<div class="read-more">';
    $output .= apply_filters( 'post-content-shortcodes-item-link-open', '<a>get_shortlink_from_blog( $p->ID, $atts['blog_id'] ) . '" title="' . apply_filters( 'the_title_attribute', $p->post_title ) . '">read more' );
    $output .= apply_filters( 'post-content-shortcodes-item-link-close', '</a></div>' );

    And then in your CSS style the div.read-more any way you like. For example:

    div.read-more {text-align:right;font-weight:bold;font-size:1.2em;}

    cozbaldwin

    (@cozbaldwin)

    Correction to Mayur’s code:

    $output .= '<div class="read-more">';
    $output .= apply_filters( 'post-content-shortcodes-item-link-open', '<a href="' . $this->get_shortlink_from_blog( $p->ID, $atts['blog_id'] ) . '" title="' . apply_filters( 'the_title_attribute', $p->post_title ) . '">read more' );
    $output .= apply_filters( 'post-content-shortcodes-item-link-close', '</a></div>' );

    Reinterating that this does indeed need to be posted after line 350, which currently is the line that reads:

    $output .= '<div class="pcs-excerpt">' . apply_filters( 'post-content-shortcodes-list-excerpt', apply_filters( 'the_content', $excerpt . $read_more ), $p ) . '</div></div>';

    Plugin Author Curtiss Grymala

    (@cgrymala)

    Instead of modifying the plugin files, have you tried simply adding “read_more=1” to the shortcode?

    [post-list orderby=rand numberposts=8 category=91 show_excerpt=true excerpt_length=50 post_type=post show_image=true image_width=100 image_height=100 read_more=1]

    The current version of the plugin should then output the “Read more” link at the end of the excerpt, regardless of the excerpt length. If it doesn’t (and you already made sure to restore the plugin to its original code), let me know and I’ll look into a possible bug. Thanks.

    cozbaldwin

    (@cozbaldwin)

    Hm. Guess I didn’t realize that was an option. After returning class-post-content-shortcodes.php to the original, adding “read_more=1” worked.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘"Read more" link missing’ is closed to new replies.