Checkbox To Show Featured Posts From Any Post Type Without Using a Plugin or Widget

This download provides the code which enables you to display one or more entries from any post type, taxonomy and term in any Genesis hook position.

By default, the code for the 2nd method uses the genesis_after_loop hook to display a featured post from the portfolio CPT after the loop on the front page. It also displays the entry like a full width block as seen in this screenshot taken from the demo installation used to test the code.

The download folder includes 2 code snippets to display your posts.

The 1st code snippet includes the default hooks and markup to display the post according to your Genesis > Theme Settings > Content Archive settings.

The 2nd code snippet uses a new loop with custom markup to display your entries as seen in the above demo image and following demo video :

Demo Video

Shows a checkbox added to the single post edit screen enabling users to select posts to display in a custom loop, using 2 different methods with different output, on the front page or any other page in any Genesis hook position. In this case, the genesis_after_loop position.

Tested using the Genesis Sample child theme by StudioPress however will work in any Genesis child theme.

Installation Steps

There’s 2 steps :

  1. # Upload the file named featured-meta-box.php to your child theme folder like this
  2.  

  3. # Copy and paste the PHP code from the functions.php file to the end of your child themes functions file. Choose one method of output only. Either the function named custom_featured_post_loop if you want to output your entries using the default genesis markup and hooks or the code which uses the new_wp_featured_posts_block function if you want to add your own HTML markup and/or display your featured posts full width as seen in the demo video.
  4.  

Download Folder

The download folder also includes code to create a custom post type named and custom taxonomy types.

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.