• Resolved herrstrietzel

    (@15broetchenmann)


    Hi Curtiss,
    I really like your plugin.

    I’m trying to hook the ‘post-content-shortcodes-defaults’ in function.php to show post thumbnails by default.

    I tried something similar to this:

    and changed the code like this:

    function.php:

    add_filter( ‘post-content-shortcodes-defaults’, ‘custom_pcs_show_thumbnails’ );
    function custom_pcs_show_thumbnails( $defaults=array() ) {
    $defaults[‘show_image’] = true;
    }

    Everythings is working fine if I change line.62 (‘show_image’ => true,) in the plugin’s file – which is of course absolutely evil.

    Any ideas?

    Regards,
    Patrick

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

    (@cgrymala)

    @patrick – the piece you seem to be missing (I can’t 100% see your code because it got malformed in the post) is actually returning the $defaults. It should probably look more like:

    add_filter( 'post-content-shortcodes-defaults', 'custom_pcs_show_thumbnails' );
    function custom_pcs_show_thumbnails( $defaults=array() ) {
        $defaults['show_image'] = true;
        return $defaults;
    }

    Thanks.

    Thread Starter herrstrietzel

    (@15broetchenmann)

    Hi Curtiss,

    Thank you so much! Your code did it!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Override defaults 'show_image' => true,’ is closed to new replies.