-
AuthorPosts
-
April 23, 2015 at 3:21 am #433201
I have the sidebar turned ON for Single Post Entries. I want the sidebar to show on my single blog posts. But I don’t want it to show on my single portfolio entries. I also don’t want to have to turn the sidebar off individually for all the sidebar entries.
How can I edit single-portfolio.php to remove the sidebar? I’m sure I can use css to hide it but there must be a better way.
April 23, 2015 at 9:56 pm #433790Hey hmsvictory!
The best way would be to use the option when editing the portfolio post. There may come a time where you decide you want a sidebar on one post only and then you would have to redo a bunch of changes.
Best regards,
ElliottApril 23, 2015 at 9:59 pm #433792I appreciate the reply but that is something I already know myself – I can’t consider that support.
I have no problem customizing the template files – what do I need to do to make it impossible for single-portfolio.php to have a sidebar?
April 24, 2015 at 9:03 am #433958Hi!
Add this in the functions.php file if you want the portfolio to have no sidebar:
add_filter('avia_layout_filter', 'avia_change_portfolio_layout', 10, 2); function avia_change_portfolio_layout($layout, $post_id){ if(is_singular('portfolio')) { $layout['current']['main'] = "fullsize"; } return $layout; }
Best regards,
IsmaelApril 24, 2015 at 6:03 pm #434299Thanks Ismael, this made the sidebar disappear on the portfolio pages.
The <main> is still .av-content-small instead of .avi-content-full, so the content are is not the proper width. I am using the default template files.
April 25, 2015 at 5:49 am #434581I’ve been playing with single-portfiolio.php and none of the changes are affecting the Single Portfolios. Just adding a test phrase like “hello” within the code does not show up on the site. Is it possible that single-portfolio.php is not controling the display of single portfolio items on the website?
Modifying the single-portfolio.php in my child theme folder to look like this has no effect on what is displayed on the single portfolios.
April 25, 2015 at 6:38 am #434602Hey!
It’s not working because you’re using the advance layout builder to create the portfolio items. Remove the modifications then replace the code in functions.php with this:
add_filter('avia_layout_filter', 'avia_change_portfolio_layout', 10, 2); function avia_change_portfolio_layout($layout, $post_id){ if(is_singular('portfolio')) { $layout['current']['content'] = "av-content-full"; $layout['current']['main'] = "fullsize"; } return $layout; }
Regards,
IsmaelApril 25, 2015 at 6:43 am #434604Boom. That works.
Many thanks for the help. Now back to playing with some custom post types & Enfold :)
April 27, 2015 at 4:37 am #434976 -
AuthorPosts
- You must be logged in to reply to this topic.