Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #383759

    Hi there. Sorry if this is discussed elsewhere. I’ve searched and haven’t found a solution.

    I’ve figured out how to add settings to the theme options for whether or not custom posts and their archives should have sidebars and which side those sidebars should show on. That was pretty straightforward. I’ve even been able to implement the sidebar settings using filters like

    avia_layout_filter

    There’s one thing that I can’t figure out how to implement with filters, though. In sidebar.php, there is a series of lines like this:

    if ($avia_config['currently_viewing'] == 'page' && dynamic_sidebar('Sidebar Pages') ) : $default_sidebar = false; endif;

    I’d like to implement (via filters) an equivalent line for a different “current_viewing” value such as this:

    if ($avia_config['currently_viewing'] == 'recipes' && dynamic_sidebar('Recipe Sidebar') ) : $default_sidebar = false; endif;

    It seems like the ideal place to do that would be using the avf_show_default_sidebars a couple lines below on line 77. But the problem I see is that the apply_filters statement doesn’t pass the “current_viewing” value. At this point, it seems like the only way to accomplish what I’m trying to do is to copy sidebar.php into my child theme and hack it. I want to avoid that if I can so I don’t get in the way of future updates to Enfold.

    Can you tell me if there’s some way to implement this logic without altering sidebar.php?

    Thanks!

    #383872

    Hi Kevin!

    Thank you for coming back.

    Out of the box this is not possible.

    You can only add an action hook around line 68:

    
    // forum pages sidebars
                if ($avia_config['currently_viewing'] == 'forum' && dynamic_sidebar('Forum') ) : $default_sidebar = false; endif;
    
    

    replace with:

    
    // forum pages sidebars
                if ($avia_config['currently_viewing'] == 'forum' && dynamic_sidebar('Forum') ) : $default_sidebar = false; endif;
    
    add_action ('avf_add_custom_side_bar', $avia_config['currently_viewing']);
    

    Best regards,
    Günter

    #383922

    Okay. I’ll put this in as a feature request.

    Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Sidebar settings for custom post types and CPT archives’ is closed to new replies.