Community Forums › Forums › Archived Forums › Design Tips and Tricks › Magazine-Pro – After Entry Widget in Custom Post Types
Tagged: custom post types, magazine, Magazine Pro, widgets
- This topic has 6 replies, 2 voices, and was last updated 9 years, 8 months ago by Genesis Developer.
-
AuthorPosts
-
March 2, 2015 at 6:58 pm #142957eluviisMember
Hi, I have a problem where I can't seen to be able to get the After Entry widget to show up in my custom post types. I have a feeling it has something to do with the code below from the Magazine-Pro functions.php, but I can't seem to figure out what to change to make the widget show in my custom post type posts.
Note: I can see the home footer widgets are in this code. But I see "genesis-after-entry" in the code, so I assume that bit is also wrapped up in this.
Here's the code I'm looking at:
//* Remove entry meta in entry footer add_action( 'genesis_before_entry', 'magazine_remove_entry_meta' ); function magazine_remove_entry_meta() { //* Remove if not single post if ( ! is_single() ) { remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 ); remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 ); } } //* Add support for 3-column footer widgets add_theme_support( 'genesis-footer-widgets', 3 ); //* Add support for after entry widget add_theme_support( 'genesis-after-entry-widget-area' ); //* Relocate after entry widget remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' ); add_action( 'genesis_entry_footer', 'genesis_after_entry_widget_area' );
March 3, 2015 at 12:13 am #142980Genesis DeveloperMemberTry this code :
add_action( 'genesis_entry_footer', 'genesis_after_entry_widget_area_for_cpt', 20 ); function genesis_after_entry_widget_area_for_cpt() { if ( in_array( get_post_type(), array( 'post', 'page' ) ) || ! current_theme_supports( 'genesis-after-entry-widget-area' ) ) { return; } genesis_widget_area( 'after-entry', array( 'before' => '<div class="after-entry widget-area">', 'after' => '</div>', ) ); }
March 3, 2015 at 12:27 am #142985eluviisMember^^^ In addition to what I already have?
Man, I have to make sure I jot down your information so that I have someone to hire when I need to debug this thing. You really know your stuff.
March 3, 2015 at 12:30 am #142986eluviisMemberActually, that didn't quite work. I ended up with the content I looking for, but twice on the posts and still none on the CPTs.
Hold on... I'm trying to edit it to work...
March 3, 2015 at 12:36 am #142987eluviisMemberLol, no... I end up with the after_entry widget in many places it should not be. In some pages even twice.
I tried replacing 'posts','page' with the names of the CPTs 'quickblog','portfolio.' but it still doesn't work right.
See below:
add_action( 'genesis_entry_footer', 'genesis_after_entry_widget_area_for_cpt', 20 ); function genesis_after_entry_widget_area_for_cpt() { if ( in_array( get_post_type(), array( 'posts','quickblog', 'portfolio' ) ) || ! current_theme_supports( 'genesis-after-entry-widget-area' ) ) { return; } genesis_widget_area( 'after-entry', array( 'before' => '<div class="after-entry widget-area">', 'after' => '</div>', ) ); }
March 3, 2015 at 12:39 am #142988eluviisMemberI'm going to put this on the backburner until Wednesday. I'll be away tomorrow and I have to wrap up. But I'll be back to see if I can get this one to work. It's pretty important for the overall site.
March 3, 2015 at 12:42 am #142989Genesis DeveloperMemberReplace this line
in_array( get_post_type(), array( 'posts','quickblog', 'portfolio' ) )
by
! is_singular( array( 'posts','quickblog', 'portfolio' ) )
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.