Support » Plugin: Content Blocks (Custom Post Widget) » php template

  • Hello, i remember that it was possible to put a file named “custom-post-widget.php” in theme folder for filter the content for example by id

    Is it not possible anymore?
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Johan van der Wijk

    (@vanderwijk)

    Hi Matteo,

    This functionality is still in the plugin, what issue are you experiencing with it?

    Ciao Johan,
    this is the content of my “custom-post-widget.php” in my theme folder:

    
    if ( !$apply_content_filters ) { // Don't apply the content filter if checkbox selected
    	$content = apply_filters( 'the_content', $content);
    }
    echo $before_widget;
    $id = $content_post -> ID;
    echo 'this is the id:'.$id;
    if ($id == 60) {
        include( get_stylesheet_directory() ."/custom-post-widget-candidatura.php");
    } else {
    	
    	if ( $show_custom_post_title ) {
    		echo $before_title;
    		echo apply_filters( 'widget_title',$content_post->post_title);
    		if ( $show_featured_image ) {
    			echo get_the_post_thumbnail( $content_post -> ID );
    		}
    		echo $after_title;
    	}
    	echo do_shortcode( $content );
    }
    echo $after_widget;
    

    and using php shortcode to include in my page:

    echo do_shortcode('[content_block id="60"]')
    

    but cant see neither the echo “this is the id”, like is not reading the file “custom-post-widget.php”

    Thanks

    Plugin Author Johan van der Wijk

    (@vanderwijk)

    You will have to disable the content filters in your shortcode, or it will skip the first if statement where you made your modifications.

    Alternatively, you can try echoing something after the line

    echo do_shortcode( $content );

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.