Show Grid of Portfolio Custom Post Type Featured Images Using Custom Loop

Someone asked a great question recently about wanting to use get_template_part to display the content of a portfolio archive page after single posts.

You can’t use get_template_part() to display the content of an archive page in Genesis because there’s no content.php file.

Here’s 2 solutions you can use.

One solution is to use a customized version of the Genesis featured posts widget which only displays posts from the portfolio CPT, as i modified it for members to do this.

Then add a tiny bit of CSS to display your Portfolio CPT images in a grid in any widget area.

Another solution is to use a custom loop which enables you to use all the power a new WP_Query provides with the massive range of parameters as well.

Here’s the result using a custom loop hooked to the genesis_entry_footer:

portfolio images

This code works in any theme however you will need to swap out genesis_get_image with code that makes the_post_thumbnail display work in non Genesis themes.

Custom Loop for Portfolio Post Type

Simply add this PHP code to the end of your child themes functions.php file and your CPT portfolio images will display exactly as shown in the screen shot above.

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.