Skip to content

Instantly share code, notes, and snippets.

@vanderwijk
Created March 10, 2021 09:33
Show Gist options
  • Save vanderwijk/a396171845cf923c23d09dddb4269fb1 to your computer and use it in GitHub Desktop.
Save vanderwijk/a396171845cf923c23d09dddb4269fb1 to your computer and use it in GitHub Desktop.
Custom template example for widgets
<?php
if ( !$apply_content_filters ) { // Don't apply the content filter if checkbox selected
$content = apply_filters( 'the_content', $content);
}
echo $before_widget;
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; // This is the line that displays the title (only if show title is set)
}
echo do_shortcode( $content ); // This is where the actual content of the custom post is being displayed
echo $after_widget;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment