• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

I want to show only one div from each post for genesis featured posts widget

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › I want to show only one div from each post for genesis featured posts widget

This topic is: not resolved

Tagged: genesis featured posts

  • This topic has 1 reply, 2 voices, and was last updated 8 years, 7 months ago by Brad Dalton.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • December 8, 2016 at 1:46 pm #197196
    dkersten
    Member

    Hello,

    I want to show only one div for each post for the genesis featured posts widget. The div I want to show has a class of .homepage-content.

    I'm not very familiar with PHP and haven't been able to figure it out thus far. My plan is to edit the genesis featured post widget (I'll update it every time I update Genesis).

    Here is the Genesis Featured Posts code:

    <?php
    /**
     * Genesis Framework.
     *
     * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
     * Please do all modifications in the form of a child theme.
     *
     * @package Genesis\Widgets
     * @author  StudioPress
     * @license GPL-2.0+
     * @link    http://my.studiopress.com/themes/genesis/
     */
    
    /**
     * Genesis Featured Post widget class.
     *
     * @since 0.1.8
     *
     * @package Genesis\Widgets
     */
    class Genesis_Featured_Post extends WP_Widget {
    
    	/**
    	 * Holds widget settings defaults, populated in constructor.
    	 *
    	 * @var array
    	 */
    	protected $defaults;
    
    	/**
    	 * Constructor. Set the default widget options and create widget.
    	 *
    	 * @since 0.1.8
    	 */
    	function __construct() {
    
    		$this->defaults = array(
    			'title'                   => '',
    			'posts_cat'               => '',
    			'posts_num'               => '',
    			'posts_offset'            => 0,
    			'orderby'                 => '',
    			'order'                   => '',
    			'exclude_displayed'       => 0,
    			'exclude_sticky'          => 0,
    			'show_image'              => 0,
    			'image_alignment'         => '',
    			'image_size'              => '',
    			'show_gravatar'           => 0,
    			'gravatar_alignment'      => '',
    			'gravatar_size'           => '',
    			'show_title'              => 0,
    			'show_byline'             => 0,
    			'post_info'               => '[post_date] ' . __( 'By', 'genesis' ) . ' [post_author_posts_link] [post_comments]',
    			'show_content'            => 'excerpt',
    			'content_limit'           => '',
    			'more_text'               => __( '[Read More...]', 'genesis' ),
    			'extra_num'               => '',
    			'extra_title'             => '',
    			'more_from_category'      => '',
    			'more_from_category_text' => __( 'More Posts from this Category', 'genesis' ),
    		);
    
    		$widget_ops = array(
    			'classname'   => 'featured-content featuredpost',
    			'description' => __( 'Displays featured posts with thumbnails', 'genesis' ),
    		);
    
    		$control_ops = array(
    			'id_base' => 'featured-post',
    			'width'   => 505,
    			'height'  => 350,
    		);
    
    		parent::__construct( 'featured-post', __( 'Genesis - Featured Posts', 'genesis' ), $widget_ops, $control_ops );
    
    	}
    
    	/**
    	 * Echo the widget content.
    	 *
    	 * @since 0.1.8
    	 *
    	 * @global WP_Query $wp_query               Query object.
    	 * @global array    $_genesis_displayed_ids Array of displayed post IDs.
    	 * @global int      $more
    	 *
    	 * @param array $args     Display arguments including <code>before_title</code>, <code>after_title</code>,
    	 *                        <code>before_widget</code>, and <code>after_widget</code>.
    	 * @param array $instance The settings for the particular instance of the widget.
    	 */
    	function widget( $args, $instance ) {
    
    		global $wp_query, $_genesis_displayed_ids;
    
    		// Merge with defaults.
    		$instance = wp_parse_args( (array) $instance, $this-&gt;defaults );
    
    		echo $args['before_widget'];
    
    		// Set up the author bio.
    		if ( ! empty( $instance['title'] ) )
    			echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'], $instance, $this-&gt;id_base ) . $args['after_title'];
    
    		$query_args = array(
    			'post_type'           =&gt; 'post',
    			'cat'                 =&gt; $instance['posts_cat'],
    			'showposts'           =&gt; $instance['posts_num'],
    			'offset'              =&gt; $instance['posts_offset'],
    			'orderby'             =&gt; $instance['orderby'],
    			'order'               =&gt; $instance['order'],
    			'ignore_sticky_posts' =&gt; $instance['exclude_sticky'],
    		);
    
    		// Exclude displayed IDs from this loop?
    		if ( $instance['exclude_displayed'] )
    			$query_args['post__not_in'] = (array) $_genesis_displayed_ids;
    
    		$wp_query = new WP_Query( $query_args );
    
    		if ( have_posts() ) : while ( have_posts() ) : the_post();
    
    			$_genesis_displayed_ids[] = get_the_ID();
    
    			genesis_markup( array(
    				'open'    =&gt; '&lt;article %s&gt;',
    				'context' =&gt; 'entry',
    			) );
    
    			$image = genesis_get_image( array(
    				'format'  =&gt; 'html',
    				'size'    =&gt; $instance['image_size'],
    				'context' =&gt; 'featured-post-widget',
    				'attr'    =&gt; genesis_parse_attr( 'entry-image-widget', array ( 'alt' =&gt; get_the_title() ) ),
    			) );
    
    			if ( $instance['show_image'] &amp;&amp; $image ) {
    				$role = empty( $instance['show_title'] ) ? '' : 'aria-hidden="true"';
    				printf( '<a href="%s">%s</a>', get_permalink(), esc_attr( $instance['image_alignment'] ), $role, wp_make_content_images_responsive( $image ) );
    			}
    
    			if ( ! empty( $instance['show_gravatar'] ) ) {
    				echo '&lt;span class="' . esc_attr( $instance['gravatar_alignment'] ) . '"&gt;';
    				echo get_avatar( get_the_author_meta( 'ID' ), $instance['gravatar_size'] );
    				echo '&lt;/span&gt;';
    			}
    
    			if ( $instance['show_title'] || $instance['show_byline'] ) {
    
    				$header = '';
    
    				if ( ! empty( $instance['show_title'] ) ) {
    
    					$title = get_the_title() ? get_the_title() : __( '(no title)', 'genesis' );
    
    					/**
    					 * Filter the featured post widget title.
    					 *
    					 * @since  2.2.0
    					 *
    					 * @param string $title    Featured post title.
    					 * @param array  $instance {
    					 *     Widget settings for this instance.
    					 *
    					 *     @type string $title                   Widget title.
    					 *     @type int    $posts_cat               ID of the post category.
    					 *     @type int    $posts_num               Number of posts to show.
    					 *     @type int    $posts_offset            Number of posts to skip when
    					 *                                           retrieving.
    					 *     @type string $orderby                 Field to order posts by.
    					 *     @type string $order                   ASC fr ascending order, DESC for
    					 *                                           descending order of posts.
    					 *     @type bool   $exclude_displayed       True if posts shown in main output
    					 *                                           should be excluded from this widget
    					 *                                           output.
    					 *     @type bool   $show_image              True if featured image should be
    					 *                                           shown, false otherwise.
    					 *     @type string $image_alignment         Image alignment: alignnone,
    					 *                                           alignleft, aligncenter or alignright.
    					 *     @type string $image_size              Name of the image size.
    					 *     @type bool   $show_gravatar           True if author avatar should be
    					 *                                           shown, false otherwise.
    					 *     @type string $gravatar_alignment      Author avatar alignment: alignnone,
    					 *                                           alignleft or aligncenter.
    					 *     @type int    $gravatar_size           Dimension of the author avatar.
    					 *     @type bool   $show_title              True if featured page title should
    					 *                                           be shown, false otherwise.
    					 *     @type bool   $show_byline             True if post info should be shown,
    					 *                                           false otherwise.
    					 *     @type string $post_info               Post info contents to show.
    					 *     @type bool   $show_content            True if featured page content
    					 *                                           should be shown, false otherwise.
    					 *     @type int    $content_limit           Amount of content to show, in
    					 *                                           characters.
    					 *     @type int    $more_text               Text to use for More link.
    					 *     @type int    $extra_num               Number of extra post titles to show.
    					 *     @type string $extra_title             Heading for extra posts.
    					 *     @type bool   $more_from_category      True if showing category archive
    					 *                                           link, false otherwise.
    					 *     @type string $more_from_category_text Category archive link text.
    					 * }
    					 * @param array  $args     {
    					 *     Widget display arguments.
    					 *
    					 *     @type string $before_widget Markup or content to display before the widget.
    					 *     @type string $before_title  Markup or content to display before the widget title.
    					 *     @type string $after_title   Markup or content to display after the widget title.
    					 *     @type string $after_widget  Markup or content to display after the widget.
    					 * }
    					 */
    					$title = apply_filters( 'genesis_featured_post_title', $title, $instance, $args );
    					$heading = genesis_a11y( 'headings' ) ? 'h4' : 'h2';
    
    					$header .= genesis_markup( array(
    						'open'    =&gt; "&lt;{$heading} class=\"entry-title\"&gt;",
    						'close'   =&gt; "&lt;/{$heading}&gt;",
    						'context' =&gt; 'widget-entry-title',
    						'content' =&gt; sprintf( '<a href="%s">%s</a>', get_permalink(), $title ),
    						'echo'    =&gt; false
    					) );
    
    				}
    
    				if ( ! empty( $instance['show_byline'] ) &amp;&amp; ! empty( $instance['post_info'] ) ) {
    					$header .= genesis_markup( array(
    						'open'    =&gt; '&lt;p class="entry-meta"&gt;',
    						'close'   =&gt; '&lt;/p&gt;',
    						'context' =&gt; 'widget-entry-meta',
    						'content' =&gt; do_shortcode( $instance['post_info'] ),
    						'echo'    =&gt; false
    					) );
    				}
    
    				genesis_markup( array(
    					'open'    =&gt; '&lt;header class="entry-header"&gt;',
    					'close'   =&gt; '&lt;/header&gt;',
    					'context' =&gt; 'entry-header',
    					'content' =&gt; $header,
    				) );
    
    			}
    
    			if ( ! empty( $instance['show_content'] ) ) {
    
    				genesis_markup( array(
    					'open'    =&gt; '&lt;div %s&gt;',
    					'context' =&gt; 'entry-content',
    				) );
    
    				if ( 'excerpt' == $instance['show_content'] ) {
    					the_excerpt();
    				}
    				elseif ( 'content-limit' == $instance['show_content'] ) {
    					the_content_limit( (int) $instance['content_limit'], genesis_a11y_more_link( esc_html( $instance['more_text'] ) ) );
    				}
    				else {
    
    					global $more;
    
    					$orig_more = $more;
    					$more = 0;
    
    					the_content( genesis_a11y_more_link( esc_html( $instance['more_text'] ) ) );
    
    					$more = $orig_more;
    
    				}
    
    				genesis_markup( array(
    					'close'   =&gt; '&lt;/div&gt;',
    					'context' =&gt; 'entry-content',
    				) );
    
    			}
    
    			genesis_markup( array(
    				'close'   =&gt; '&lt;/article&gt;',
    				'context' =&gt; 'entry',
    			) );
    
    		endwhile; endif;
    
    		// Restore original query.
    		wp_reset_query();
    
    		// The EXTRA Posts (list).
    		if ( ! empty( $instance['extra_num'] ) ) {
    			if ( ! empty( $instance['extra_title'] ) ) {
    				echo $args['before_title'] . '&lt;span class="more-posts-title"&gt;' . esc_html( $instance['extra_title'] ) . '&lt;/span&gt;' . $args['after_title'];
    			}
    
    			$offset = intval( $instance['posts_num'] ) + intval( $instance['posts_offset'] );
    
    			$query_args = array(
    				'cat'       =&gt; $instance['posts_cat'],
    				'showposts' =&gt; $instance['extra_num'],
    				'offset'    =&gt; $offset,
    			);
    
    			$wp_query = new WP_Query( $query_args );
    
    			$listitems = '';
    
    			if ( have_posts() ) {
    				while ( have_posts() ) {
    					the_post();
    					$_genesis_displayed_ids[] = get_the_ID();
    					$listitems .= sprintf( '<li><a href="%s">%s</a></li>', get_permalink(), get_the_title() );
    				}
    
    				if ( mb_strlen( $listitems ) &gt; 0 )
    					printf( '&lt;ul class="more-posts"&gt;%s</ul>', $listitems );
    			}
    
    			// Restore original query.
    			wp_reset_query();
    		}
    
    		if ( ! empty( $instance['more_from_category'] ) &amp;&amp; ! empty( $instance['posts_cat'] ) )
    			printf(
    				'&lt;p class="more-from-category"&gt;<a href="%1$s" title="%2$s">%3$s</a>&lt;/p&gt;',
    				esc_url( get_category_link( $instance['posts_cat'] ) ),
    				esc_attr( get_cat_name( $instance['posts_cat'] ) ),
    				esc_html( $instance['more_from_category_text'] )
    			);
    
    		echo $args['after_widget'];
    
    	}
    
    	/**
    	 * Update a particular instance.
    	 *
    	 * This function should check that $new_instance is set correctly.
    	 * The newly calculated value of $instance should be returned.
    	 * If "false" is returned, the instance won't be saved/updated.
    	 *
    	 * @since 0.1.8
    	 *
    	 * @param array $new_instance New settings for this instance as input by the user via <code>form()</code>.
    	 * @param array $old_instance Old settings for this instance.
    	 * @return array Settings to save or bool false to cancel saving.
    	 */
    	function update( $new_instance, $old_instance ) {
    
    		$post_num = intval( $new_instance['posts_num'] );
    		$new_instance['posts_num'] = $post_num &gt; 0 &amp;&amp; $post_num &lt; 100 ? $post_num : 1;
    		$new_instance['title']     = strip_tags( $new_instance['title'] );
    		$new_instance['more_text'] = strip_tags( $new_instance['more_text'] );
    		$new_instance['post_info'] = wp_kses_post( $new_instance['post_info'] );
    		return $new_instance;
    
    	}
    
    	/**
    	 * Echo the settings update form.
    	 *
    	 * @since 0.1.8
    	 *
    	 * @param array $instance Current settings.
    	 * @return void
    	 */
    	function form( $instance ) {
    
    		// Merge with defaults.
    		$instance = wp_parse_args( (array) $instance, $this-&gt;defaults );
    
    		?&gt;
    		&lt;p&gt;
    			&lt;label for="&lt;?php echo $this-&gt;get_field_id( 'title' ); ?&gt;"&gt;&lt;?php _e( 'Title', 'genesis' ); ?&gt;:&lt;/label&gt;
    			&lt;input type="text" id="&lt;?php echo $this-&gt;get_field_id( 'title' ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'title' ) ); ?&gt;" value="&lt;?php echo esc_attr( $instance['title'] ); ?&gt;" class="widefat" /&gt;
    		&lt;/p&gt;
    
    		&lt;div class="genesis-widget-column"&gt;
    
    			&lt;div class="genesis-widget-column-box genesis-widget-column-box-top"&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo $this-&gt;get_field_id( 'posts_cat' ); ?&gt;"&gt;&lt;?php _e( 'Category', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;?php
    					$categories_args = array(
    						'name'            =&gt; $this-&gt;get_field_name( 'posts_cat' ),
    						'id'              =&gt; $this-&gt;get_field_id( 'posts_cat' ),
    						'selected'        =&gt; $instance['posts_cat'],
    						'orderby'         =&gt; 'Name',
    						'hierarchical'    =&gt; 1,
    						'show_option_all' =&gt; __( 'All Categories', 'genesis' ),
    						'hide_empty'      =&gt; '0',
    					);
    					wp_dropdown_categories( $categories_args ); ?&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'posts_num' ) ); ?&gt;"&gt;&lt;?php _e( 'Number of Posts to Show', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;input type="text" id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'posts_num' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'posts_num' ) ); ?&gt;" value="&lt;?php echo esc_attr( $instance['posts_num'] ); ?&gt;" size="2" placeholder="1" /&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'posts_offset' ) ); ?&gt;"&gt;&lt;?php _e( 'Number of Posts to Offset', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;input type="text" id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'posts_offset' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'posts_offset' ) ); ?&gt;" value="&lt;?php echo esc_attr( $instance['posts_offset'] ); ?&gt;" size="2" /&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'orderby' ) ); ?&gt;"&gt;&lt;?php _e( 'Order By', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;select id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'orderby' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'orderby' ) ); ?&gt;"&gt;
    						&lt;option value="date" &lt;?php selected( 'date', $instance['orderby'] ); ?&gt;&gt;&lt;?php _e( 'Date', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="title" &lt;?php selected( 'title', $instance['orderby'] ); ?&gt;&gt;&lt;?php _e( 'Title', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="parent" &lt;?php selected( 'parent', $instance['orderby'] ); ?&gt;&gt;&lt;?php _e( 'Parent', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="ID" &lt;?php selected( 'ID', $instance['orderby'] ); ?&gt;&gt;&lt;?php _e( 'ID', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="comment_count" &lt;?php selected( 'comment_count', $instance['orderby'] ); ?&gt;&gt;&lt;?php _e( 'Comment Count', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="rand" &lt;?php selected( 'rand', $instance['orderby'] ); ?&gt;&gt;&lt;?php _e( 'Random', 'genesis' ); ?&gt;&lt;/option&gt;
    					&lt;/select&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'order' ) ); ?&gt;"&gt;&lt;?php _e( 'Sort Order', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;select id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'order' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'order' ) ); ?&gt;"&gt;
    						&lt;option value="DESC" &lt;?php selected( 'DESC', $instance['order'] ); ?&gt;&gt;&lt;?php _e( 'Descending (3, 2, 1)', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="ASC" &lt;?php selected( 'ASC', $instance['order'] ); ?&gt;&gt;&lt;?php _e( 'Ascending (1, 2, 3)', 'genesis' ); ?&gt;&lt;/option&gt;
    					&lt;/select&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;input id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'exclude_displayed' ) ); ?&gt;" type="checkbox" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'exclude_displayed' ) ); ?&gt;" value="1" &lt;?php checked( $instance['exclude_displayed'] ); ?&gt;/&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'exclude_displayed' ) ); ?&gt;"&gt;&lt;?php _e( 'Exclude Previously Displayed Posts?', 'genesis' ); ?&gt;&lt;/label&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;input id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'exclude_sticky' ) ); ?&gt;" type="checkbox" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'exclude_sticky' ) ); ?&gt;" value="1" &lt;?php checked( $instance['exclude_sticky'] ); ?&gt;/&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'exclude_sticky' ) ); ?&gt;"&gt;&lt;?php _e( 'Exclude Sticky Posts?', 'genesis' ); ?&gt;&lt;/label&gt;
    				&lt;/p&gt;
    
    			&lt;/div&gt;
    
    			&lt;div class="genesis-widget-column-box"&gt;
    
    				&lt;p&gt;
    					&lt;input id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'show_gravatar' ) ); ?&gt;" type="checkbox" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'show_gravatar' ) ); ?&gt;" value="1" &lt;?php checked( $instance['show_gravatar'] ); ?&gt;/&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'show_gravatar' ) ); ?&gt;"&gt;&lt;?php _e( 'Show Author Gravatar', 'genesis' ); ?&gt;&lt;/label&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'gravatar_size' ) ); ?&gt;"&gt;&lt;?php _e( 'Gravatar Size', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;select id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'gravatar_size' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'gravatar_size' ) ); ?&gt;"&gt;
    						&lt;option value="45" &lt;?php selected( 45, $instance['gravatar_size'] ); ?&gt;&gt;&lt;?php _e( 'Small (45px)', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="65" &lt;?php selected( 65, $instance['gravatar_size'] ); ?&gt;&gt;&lt;?php _e( 'Medium (65px)', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="85" &lt;?php selected( 85, $instance['gravatar_size'] ); ?&gt;&gt;&lt;?php _e( 'Large (85px)', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="125" &lt;?php selected( 125, $instance['gravatar_size'] ); ?&gt;&gt;&lt;?php _e( 'Extra Large (125px)', 'genesis' ); ?&gt;&lt;/option&gt;
    					&lt;/select&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'gravatar_alignment' ) ); ?&gt;"&gt;&lt;?php _e( 'Gravatar Alignment', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;select id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'gravatar_alignment' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'gravatar_alignment' ) ); ?&gt;"&gt;
    						&lt;option value="alignnone"&gt;- &lt;?php _e( 'None', 'genesis' ); ?&gt; -&lt;/option&gt;
    						&lt;option value="alignleft" &lt;?php selected( 'alignleft', $instance['gravatar_alignment'] ); ?&gt;&gt;&lt;?php _e( 'Left', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="alignright" &lt;?php selected( 'alignright', $instance['gravatar_alignment'] ); ?&gt;&gt;&lt;?php _e( 'Right', 'genesis' ); ?&gt;&lt;/option&gt;
    					&lt;/select&gt;
    				&lt;/p&gt;
    
    			&lt;/div&gt;
    
    			&lt;div class="genesis-widget-column-box"&gt;
    
    				&lt;p&gt;
    					&lt;input id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'show_image' ) ); ?&gt;" type="checkbox" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'show_image' ) ); ?&gt;" value="1" &lt;?php checked( $instance['show_image'] ); ?&gt;/&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'show_image' ) ); ?&gt;"&gt;&lt;?php _e( 'Show Featured Image', 'genesis' ); ?&gt;&lt;/label&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'image_size' ) ); ?&gt;"&gt;&lt;?php _e( 'Image Size', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;select id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'image_size' ) ); ?&gt;" class="genesis-image-size-selector" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'image_size' ) ); ?&gt;"&gt;
    						&lt;?php
    						$sizes = genesis_get_image_sizes();
    						foreach( (array) $sizes as $name =&gt; $size )
    							printf( '&lt;option value="%s" %s&gt;%s (%sx%s)&lt;/option&gt;', esc_attr( $name ), selected( $name, $instance['image_size'], false ), esc_html( $name ), esc_html( $size['width'] ), esc_html( $size['height'] ) );
    						?&gt;
    					&lt;/select&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'image_alignment' ) ) ; ?&gt;"&gt;&lt;?php _e( 'Image Alignment', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;select id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'image_alignment' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'image_alignment' ) ); ?&gt;"&gt;
    						&lt;option value="alignnone"&gt;- &lt;?php _e( 'None', 'genesis' ); ?&gt; -&lt;/option&gt;
    						&lt;option value="alignleft" &lt;?php selected( 'alignleft', $instance['image_alignment'] ); ?&gt;&gt;&lt;?php _e( 'Left', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="alignright" &lt;?php selected( 'alignright', $instance['image_alignment'] ); ?&gt;&gt;&lt;?php _e( 'Right', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="aligncenter" &lt;?php selected( 'aligncenter', $instance['image_alignment'] ); ?&gt;&gt;&lt;?php _e( 'Center', 'genesis' ); ?&gt;&lt;/option&gt;
    					&lt;/select&gt;
    				&lt;/p&gt;
    
    			&lt;/div&gt;
    
    		&lt;/div&gt;
    
    		&lt;div class="genesis-widget-column genesis-widget-column-right"&gt;
    
    			&lt;div class="genesis-widget-column-box genesis-widget-column-box-top"&gt;
    
    				&lt;p&gt;
    					&lt;input id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'show_title' ) ); ?&gt;" type="checkbox" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'show_title' ) ); ?&gt;" value="1" &lt;?php checked( $instance['show_title'] ); ?&gt;/&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'show_title' ) ); ?&gt;"&gt;&lt;?php _e( 'Show Post Title', 'genesis' ); ?&gt;&lt;/label&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;input id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'show_byline' ) ); ?&gt;" type="checkbox" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'show_byline' ) ); ?&gt;" value="1" &lt;?php checked( $instance['show_byline'] ); ?&gt;/&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'show_byline' ) ); ?&gt;"&gt;&lt;?php _e( 'Show Post Info', 'genesis' ); ?&gt;&lt;/label&gt;
    
    					&lt;input type="text" id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'post_info' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'post_info' ) ); ?&gt;" value="&lt;?php echo esc_attr( $instance['post_info'] ); ?&gt;" class="widefat" /&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'post_info' ) ); ?&gt;" class="screen-reader-text"&gt;&lt;?php _e( 'Content Post Info', 'genesis' ); ?&gt;&lt;/label&gt;
    
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'show_content' ) ); ?&gt;"&gt;&lt;?php _e( 'Content Type', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;select id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'show_content' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'show_content' ) ); ?&gt;"&gt;
    						&lt;option value="content" &lt;?php selected( 'content', $instance['show_content'] ); ?&gt;&gt;&lt;?php _e( 'Show Content', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="excerpt" &lt;?php selected( 'excerpt', $instance['show_content'] ); ?&gt;&gt;&lt;?php _e( 'Show Excerpt', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="content-limit" &lt;?php selected( 'content-limit', $instance['show_content'] ); ?&gt;&gt;&lt;?php _e( 'Show Content Limit', 'genesis' ); ?&gt;&lt;/option&gt;
    						&lt;option value="" &lt;?php selected( '', $instance['show_content'] ); ?&gt;&gt;&lt;?php _e( 'No Content', 'genesis' ); ?&gt;&lt;/option&gt;
    					&lt;/select&gt;
    					&lt;br /&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'content_limit' ) ); ?&gt;"&gt;&lt;?php _e( 'Limit content to', 'genesis' ); ?&gt;
    						&lt;input type="text" id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'content_limit' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'content_limit' ) ); ?&gt;" value="&lt;?php echo esc_attr( intval( $instance['content_limit'] ) ); ?&gt;" size="3" /&gt;
    						&lt;?php _e( 'characters', 'genesis' ); ?&gt;
    					&lt;/label&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'more_text' ) ); ?&gt;"&gt;&lt;?php _e( 'More Text (if applicable)', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;input type="text" id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'more_text' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'more_text' ) ); ?&gt;" value="&lt;?php echo esc_attr( $instance['more_text'] ); ?&gt;" /&gt;
    				&lt;/p&gt;
    
    			&lt;/div&gt;
    
    			&lt;div class="genesis-widget-column-box"&gt;
    
    				&lt;p id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'extra_title' ) ); ?&gt;-descr"&gt;&lt;?php _e( 'To display an unordered list of more posts from this category, please fill out the information below', 'genesis' ); ?&gt;:&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'extra_title' ) ); ?&gt;"&gt;&lt;?php _e( 'Title', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;input type="text" id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'extra_title' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'extra_title' ) ); ?&gt;" value="&lt;?php echo esc_attr( $instance['extra_title'] ); ?&gt;" class="widefat" aria-describedby="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'extra_title' ) ); ?&gt;-descr" /&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'extra_num' ) ); ?&gt;"&gt;&lt;?php _e( 'Number of Posts to Show', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;input type="text" id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'extra_num' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'extra_num' ) ); ?&gt;" value="&lt;?php echo esc_attr( $instance['extra_num'] ); ?&gt;" size="2" /&gt;
    				&lt;/p&gt;
    
    			&lt;/div&gt;
    
    			&lt;div class="genesis-widget-column-box"&gt;
    
    				&lt;p&gt;
    					&lt;input id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'more_from_category' ) ); ?&gt;" type="checkbox" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'more_from_category' ) ); ?&gt;" value="1" &lt;?php checked( $instance['more_from_category'] ); ?&gt;/&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'more_from_category' ) ); ?&gt;"&gt;&lt;?php _e( 'Show Category Archive Link', 'genesis' ); ?&gt;&lt;/label&gt;
    				&lt;/p&gt;
    
    				&lt;p&gt;
    					&lt;label for="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'more_from_category_text' ) ); ?&gt;"&gt;&lt;?php _e( 'Link Text', 'genesis' ); ?&gt;:&lt;/label&gt;
    					&lt;input type="text" id="&lt;?php echo esc_attr( $this-&gt;get_field_id( 'more_from_category_text' ) ); ?&gt;" name="&lt;?php echo esc_attr( $this-&gt;get_field_name( 'more_from_category_text' ) ); ?&gt;" value="&lt;?php echo esc_attr( $instance['more_from_category_text'] ); ?&gt;" class="widefat" /&gt;
    				&lt;/p&gt;
    
    			&lt;/div&gt;
    
    		&lt;/div&gt;
    		&lt;?php
    
    	}
    
    }
    
    
    December 8, 2016 at 1:53 pm #197294
    Brad Dalton
    Participant

    You can copy the genesis featured posts widget to your child theme and modify it there.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble