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

WP SITES

2662

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

Add Widget After Posts Using Custom Post Type

Here’s the code you can add to the end of your child themes functions.php file which will create a new widget that displays your content after all single posts assigned to a custom post type named portfolio.

If the name of your custom post type isn’t portfolio, you can change the name from portfolio to another in this line of code:

if( 'portfolio' == get_post_type() && is_single() && is_active_sidebar( 'portfolio-widget' ) ) {

If your posts are simply assigned to a category and NOT a custom post type, then use this code.

Custom Post Type

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems