• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Custom Featured Image For Genesis Featured Posts Widget

This tutorial provides the code which enables you to add a custom image for each post displayed using the Genesis featured posts widget. By default, the featured posts widget uses the featured image.

If a custom image is added to any single post, the custom image is displayed in the featured posts widget and not the featured image. If no custom image is added, the featured image is used.

Here’s a screenshot showing the same single post ( 1 ) displayed on a archive ( left ) which uses the default featured image and ( 2 ) in the primary sidebar ( right ) which uses the custom image.

Here’s the demo showing how it works.

Demo Video #

The demo video shows you how to follow the 3 steps to install the code, setup and add the custom featured image for use in the Genesis featured posts widget.

Code Functionality

The code enables you to:

  • Use a different/custom featured image in the Genesis featured posts widget.
  • Choose the size and alignment of the custom image using the Genesis featured posts widget settings.
  • Display the default featured image when no custom image added.

Installation Steps #

Installation of the code only requires 3 steps after downloading the zip file below.

Step 1 : Upload the file named custom-featured-post-widget.php to your child themes root directory.

Step 2 : Add the following PHP code to the end of your child themes functions.php file.

include_once( get_stylesheet_directory() . '/featured-posts.php' );

add_action( 'widgets_init', 'custom_featured_posts_image' );
function custom_featured_posts_image() {
    register_widget( 'Featured_Posts' );
}

Step 3 : Install the ACF plugin and create a new field named image like your see in the following ACF settings:

Here’s the code for logged in members:

Download files

Register for full access

Custom Fields Genesis Featured Posts

Reader Interactions

Comments

  1. Patrick Barnes says

    April 25, 2020 at 7:38 pm

    Your Step 1 has the wrong file name. The file name should be custom-featured-post-widget.php.

    Log in to Reply
    • Brad Dalton says

      April 25, 2020 at 11:53 pm

      Thanks Patrick. Updated.

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.