• Resolved PG

    (@parulgarg2)


    Hi

    I needed to use the shortcode feature of this plugin, I tried but for some reasons I noticed boolean values were not working. Example, When I was setting thumb=’false’, it didn’t work.

    So, i made this amendment into a file that helped. Just posting so that it may help others too.

    In file /includes/shortcode.php
    Replace rpwe_shortcode method with the following

    function rpwe_shortcode( $atts, $content ) {
    	if ( isset( $atts['cssid'] ) ) {
    		$atts['cssID'] = $atts['cssid'];
    		unset( $atts['cssid'] );
    	}
    	if( isset ($atts['thumb'] ) ){
    		$atts['thumb'] = $atts['thumb'] === 'true' ? true: false;
    	}
    	if( isset ($atts['excerpt'] ) ){
    		$atts['excerpt'] = $atts['excerpt'] === 'true' ? true: false;
    	}
    	if( isset ($atts['date'] ) ){
    		$atts['date'] = $atts['date'] === 'true' ? true: false;
    	}
    	if( isset ($atts['date_relative'] ) ){
    		$atts['date_relative'] = $atts['date_relative'] === 'true' ? true: false;
    	}
    	if( isset ($atts['date_modified'] ) ){
    		$atts['date_modified'] = $atts['date_modified'] === 'true' ? true: false;
    	}
    	if( isset ($atts['readmore'] ) ){
    		$atts['readmore'] = $atts['readmore'] === 'true' ? true: false;
    	}
    	if( isset ($atts['comment_count'] ) ){
    		$atts['comment_count'] = $atts['comment_count'] === 'true' ? true: false;
    	}
    	if( isset ($atts['styles_default'] ) ){
    		$atts['styles_default'] = $atts['styles_default'] === 'true' ? true: false;
    	}
    
    	$args = shortcode_atts( rpwe_get_default_args(), $atts );
    	return rpwe_get_recent_posts( $args );
    }
    add_shortcode( 'rpwe', 'rpwe_shortcode' );
    
  • The topic ‘Shortcode problem fix’ is closed to new replies.