WordPress.org

Ready to get started?Download WordPress

Forums

Post Content Shortcodes
"Read more" link missing (5 posts)

  1. yairharel
    Member
    Posted 1 year ago #

    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/

  2. Mayur Jobanputra
    Member
    Posted 1 year ago #

    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;}

  3. cozbaldwin
    Member
    Posted 1 year ago #

    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>';

  4. Curtiss Grymala
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. cozbaldwin
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.