Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1440945

    Is there a way to have a portfolio layout for all entries?

    Sidebar or No sidebar
    Specific Sidebar for Portfolio Entries
    Custom Builder structure
    Etc…

    I need to define how all portfolio entries should look and have a custom layout, for example no sidebar and then none has a sidebar, or custom sidebar and all of the will use that sidebar, etc…

    Thanks.

    #1441203

    Hey peterolle,
    To have a custom sidebar that only shows on portfolio posts, first create a custom widget area, in this example I named it “portfolio sidebar” and added the text widget:
    Enfold Support 5626
    then ensure that the sidebar i enabled on single post items:
    Enfold Support 5628
    Then add this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    add_filter("avf_custom_sidebar", function($custom_sidebar) {
        if(is_single() && get_post_type() === 'portfolio'){
            $custom_sidebar = "portfolio-sidebar"; 
        }
        return $custom_sidebar;
    }, 10, 1);
    

    and the sidebar will show only on portfolio posts:
    Enfold Support 5630

    Best regards,
    Mike

    #1441206

    Thank you Mike.

    I do not use sidebar in single posts, so I can’t enable that.

    I can’t have a sidebar just in portfolio items and control that?

    Also, how can I disable the sidebar, just in portfolio items?

    • This reply was modified 7 months, 3 weeks ago by peterolle.
    #1441212

    Hi,
    If in the theme settings you are going to have no sidebar as the option for Sidebar On Single Post Entries
    Enfold Support 5632
    but still want a sidebar to show only on portfolio posts, add this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function enable_sidebar_on_portfolio_posts_when_disabled_in_theme_settings($layout, $post_id) {
      if( is_single() && get_post_type() == 'portfolio') {
          $layout['current'] = $layout['sidebar_right'];
          $layout['current']['main'] = 'sidebar_right';
      }
      return $layout;
    }
    add_filter('avia_layout_filter', 'enable_sidebar_on_portfolio_posts_when_disabled_in_theme_settings', 10, 2);

    That would show the Sidebar Pages or Displayed Everywhere widget area:
    Enfold Support 5634
    If you then want a custom portfolio sidebar widget area to show, then follow the steps above.

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.