askdesign
2/12/2017 - 10:02 PM

How to move post info above title in Genesis Featured Posts widgets

February 6, 2017 by Sridhar Katakam

// Step 2
Edit class-custom-featured-post.php

// REPLACE

if ( $instance['show_title'] )
    echo genesis_html5() ? '<header class="entry-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';
 
        if ( genesis_html5() )
            printf( '<%s class="entry-title"><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading );
        else
            printf( '<%s><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading );
 
    }
 
    if ( ! empty( $instance['show_byline'] ) && ! empty( $instance['post_info'] ) )
        printf( genesis_html5() ? '<p class="entry-meta">%s</p>' : '<p class="byline post-info">%s</p>', do_shortcode( $instance['post_info'] ) );
 
if ( $instance['show_title'] )
    echo genesis_html5() ? '</header>' : '';
    
// WITH

if ( $instance['show_title'] )
    echo genesis_html5() ? '<header class="entry-header">' : '';
 
    if ( ! empty( $instance['show_byline'] ) && ! empty( $instance['post_info'] ) )
        printf( genesis_html5() ? '<p class="entry-meta">%s</p>' : '<p class="byline post-info">%s</p>', do_shortcode( $instance['post_info'] ) );
 
    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';
 
        if ( genesis_html5() )
            printf( '<%s class="entry-title"><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading );
        else
            printf( '<%s><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading );
 
    }
 
if ( $instance['show_title'] )
    echo genesis_html5() ? '</header>' : '';
Entry meta appear can be moved above the entry title in the output of Genesis Featured Posts widgets by switching the code blocks for them in the Custom Genesis Featured Posts Widget plugin’s file.

Step 1
Install and activate Custom Genesis Featured Posts Widget plugin.