How to visually highlight featured entries in the Recent Entries widget

The Recent Entries widget was added in GravityView 1.6. By default, the featured entries in the Recent Entries widget will look the same as other entries. But what if you want to highlight the featured entries?

You can use the following code to visually highlight the featured entries:

add_filter( 'gravityview/widget/recent-entries/item', array( $this, 'gravityview_wrap_recent_entries_widget_item_output' ), 10, 3 );

/**
 * Modify the item output HTML to wrap entries in a div.gv-featured-entry
 *
 * @param string $item_output The HTML output for the item
 * @param array $entry Gravity Forms entry array
 * @param array $instance The settings for the particular instance of the widget.
 *
 * @return string Modified HTML
 */
function gravityview_wrap_recent_entries_widget_item_output( $item_output, $entry, $instance ) {

	if( !empty( $entry['is_starred'] ) ) {
		$item_output = '<div class="gv-featured-entry">'.$item_output.'</div>';
	}

	return $item_output;

}

Read here how to add these code samples to your website: Where to put code samples.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us