• Hi
    This is a great plugin!
    I’m using the updated version and the only problem I came across is using the filter code previously posted in my functions.php for the image to link like the title and read more. It’s not working and I’m not sure what to edit to get it working.

    add_filter( 'post-content-shortcodes-title', 'add_link_to_pcs_content_title', 10, 3 );
    function add_link_to_pcs_content_title( $html, $title, $post=null ) {
        if ( ! is_object( $post ) ) {
            return $html;
        }
        return sprintf( '<h2><a href="%1$s">%2$s</a></h2>', apply_filters( 'the_permalink', $post->permalink ), $title );
    }

    Thanks for any help.

    https://ww.wp.xz.cn/plugins/post-content-shortcodes/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Curtiss Grymala

    (@cgrymala)

    Hmm. I don’t think there is a “permalink” property on the post object. Instead of $post->permalink try using get_permalink( $post->ID )

    Thread Starter vince102

    (@vince102)

    I tried it, but no success. I think my lack of knowledge of PHP and how this stuff works is why I can’t seem to get it to work.

    could be as easy as just putting this in your code

    line 543 of class-post-content-shortcodes.php

    if( $atts['show_image'] ) {
       $output .= $p->post_thumbnail;
    }

    replace with

    if( $atts['show_image'] ) {
       $output .= '<a href="' . $this->get_shortlink_from_blog( $p->ID, $atts['blog_id'] ) . '">' . $p->post_thumbnail . '</a>';
    }

    and here’s the pull request from GitHub

    Thread Starter vince102

    (@vince102)

    Thanks, I’ll give that a try and let you know if it worked.

    Thread Starter vince102

    (@vince102)

    That did work! Thanks so much for getting me that code. I just have to be aware of it for updating since it’s editing the plugin.

    Thanks again

    Hopefully it can make it to the next release (cough cough, Curtiss)

    Plugin Author Curtiss Grymala

    (@cgrymala)

    This didn’t make it into today’s release (so, you may need to make that same change in your copy of the plugin when you update to today’s release).

    That said, I’ll see what I can do to add a new parameter in the next feature release that allows you to link the post thumbnail in the [post-list]. Thanks for the suggestion.

    No problemo.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘featured image link’ is closed to new replies.