Community Forums › Forums › Archived Forums › Design Tips and Tricks › Remove Sidebar from custom posts or adding sidebar to blog?
Tagged: Custom post, Sidebar
- This topic has 7 replies, 3 voices, and was last updated 9 years, 9 months ago by hmistler.
-
AuthorPosts
-
July 31, 2014 at 4:54 pm #116484hmistlerMember
Hello! I am trying to remove my primary sidebar from my custom post pages (I am using a plugin called Go Portfolio for my portfolio pages; these are my custom post pages I wish to remove my primary sidebar from.)
Here's how the pages look now: http://www.haleymistlerdesign.com/portfolio/67/
I've been researching for quite some time but haven't found anything related to getting rid of this on custom posts.
OR...my other thought was to set the default layout to full width and just have the primary sidebar appear on the News (blog) page, which is really the only place I want it. Tried this and had no luck, either.
Whichever one is easier, I'm willing to try it. Help!
http://www.haleymistlerdesign.comJuly 31, 2014 at 5:58 pm #116491DTHkellyMemberHave you looked at the files in the Go Portfolio zipfolder? There is a single-portfolio.php (or whatever the "portfolio" custom post type is named). This template is calling the sidebar.
Some reference:
http://www.carriedils.com/sidebar-custom-post-type/I'm not sure why your second option didn't work? Are you selecting the content>sidebar layout for each blog post?
July 31, 2014 at 6:07 pm #116496Brad DaltonParticipantTry this using the is_singular('portfolio') conditional tag http://wpsites.net/web-design/change-layout-based-on-any-conditions/
Not sure this will work as your plugin may not use the Genesis templates
Any reason you need a plugin for CPT's?
July 31, 2014 at 10:38 pm #116526hmistlerMemberThanks for the replies...I tried setting the theme's default layout to full width, then checking the content-sidebar option in the page layout on the News page - still nothing. I feel like I might need to add some PHP code to make the sidebar appear, but how?
Or what code can I add to remove the sidebar from the portfolio pages? I was able to add in PHP code to remove the page title from the individual portfolio pages, so I know they can be tweaked in the main functions.php file.
July 31, 2014 at 10:40 pm #116527DTHkellyMemberBrad's tutorial should help: http://www.studiopress.community/topic/remove-sidebar-from-custom-posts-or-adding-sidebar-to-blog/#post-116496
July 31, 2014 at 11:01 pm #116528hmistlerMemberUnfortunately on those portfolio pages I do not have the option to write in any conditionals; it doesn't give me any layout options as in other genesis page. Still think this may have to go in functions.php I just don't know what the correct code is to remove a sidebar from posts!
July 31, 2014 at 11:17 pm #116530DTHkellyMemberThe code from Brad's tutorial is pasted into childtheme's functions.php. I use this free plugin for custom PHP
https://wordpress.org/plugins/code-snippets/You just need the conditional for the custom post type "portfolio"
Is the name of the CPT, portfolio? Or does it have a prefix? I'm guessing there's a prefix, like "go_portfolio"
http://codex.wordpress.org/Conditional_Tags
is_singular()
You have to fill in () with (
'portfolio'
) or 'go_portfolio'` or whatever the CPT is named.is_singular( 'portfolio' )
July 31, 2014 at 11:37 pm #116531hmistlerMemberAH I see what you are saying....that worked perfectly, thank you!!!!
-
AuthorPosts
- The topic ‘Remove Sidebar from custom posts or adding sidebar to blog?’ is closed to new replies.