Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Overriding the Markup with the Flexible Featured Post Widget
<?php
/**
* function wpmark_remove_ffpw_output_action()
*
* removes the flexibile featured post widgets output
*/
function wpmark_remove_ffpw_output_action() {
remove_action( 'ffpw_featured_post_output', 'ffpw_featured_post_output', 10, 3 );
}
add_action( 'init', 'wpmark_remove_ffpw_output_action' );
/**
* function wpmark_add_ffpw_widget_output()
*
* creates the markup and output for the flexible featured post widget
*
* @param array $args is the widget args e.g. before_title / after_title
* @param array $instance is the widget settings instance e.g. title, show author etc.
* @param obj $post is the post object of the featured post queried
*/
function wpmark_add_ffpw_widget_output( $args, $instance, $post ) {
echo $args[ 'before_widget' ];
/* if we have a title */
if( $instance[ 'title' ] != '' ) {
echo $args[ 'before_title' ]; echo esc_html( $title ); echo $args[ 'after_title' ];
}
?>
<h2 class="post-title">
<a href="<?php echo esc_url( get_permalink( $post->ID ) ); ?>">
<?php echo esc_html( $post->post_title ); ?>
</a>
</h2>
<?php
echo $args[ 'after_widget' ];
}
add_action( 'ffpw_featured_post_output', 'wpmark_add_ffpw_widget_output', 10, 3 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.