Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1338084

    How would someone get a subnavbar inserted on pages within a site with WooCommerce?

    So, the site navigation is better handled by the sub navbar element than the primary navigation element. So, knowing that messing with Woo and Enfold should be minimal, I tried to insert just a shortcode for a subnavbar.

    [av_submenu which_menu='' menu='23' position='center' sticky='aviaTBsticky' color='footer_color' mobile='disabled' mobile_switch='av-switch-768' alb_description='' id='subnav' custom_class='subnav' template_class='' av_uid='av-ndlzm' sc_version='1.0'] [av_submenu_item title='Menu Item 1' button_style='' link='' linktarget='' av_uid='av-gg26y' sc_version='1.0'] [av_submenu_item title='Menu Item 2' button_style='' link='' linktarget='' av_uid='av-ba2z6' sc_version='1.0'] [/av_submenu]

    But, as II half expected, it would not render that out to a navbar. Is there an easy way to allow for elements like these on Woo pages?

    #1338154

    Hey Jason,

    Thank you for the inquiry.

    Where did you add the shortcode? Instead of adding the shortcode directly to a text editor, you can use template hooks to place the element wherever you want. To place the sub navigation above the product loop, try to use this hook.

    add_action("woocommerce_before_main_content", function() {
         if( ! is_shop() ) return; 
         $menu = do_shortcode("[av_submenu which_menu='' menu='23' position='center' sticky='aviaTBsticky' color='footer_color' mobile='disabled' mobile_switch='av-switch-768' alb_description='' id='subnav' custom_class='subnav' template_class='' av_uid='av-ndlzm' sc_version='1.0'] [av_submenu_item title='Menu Item 1' button_style='' link='' linktarget='' av_uid='av-gg26y' sc_version='1.0'] [av_submenu_item title='Menu Item 2' button_style='' link='' linktarget='' av_uid='av-ba2z6' sc_version='1.0'][/av_submenu]");
         echo "<div class='av-shop-sub-nav'>" . $menu . "</div>";
    }, 10);
    

    Best regards,
    Ismael

    #1338966

    Thank you! That works beautifully!

    Sorta related question. Is there anything within Enfold/Avia that would strip shortcodes from a product short description field? I have used the function WooCommerce gives to allow shortcodes in them, but something continues to strip any/all shortcodes/code out of the field upon save/update.

    #1338967

    Oops, this is the function WooCommerce offers to allow shortcodes in the descriptions…

    Allow shortcodes in product excerpts

    /**
    * Allow shortcodes in product excerpts
    */
    if (!function_exists(‘woocommerce_template_single_excerpt’)) {
    function woocommerce_template_single_excerpt( $post ) {
    global $post;
    if ($post->post_excerpt) echo ‘<div itemprop=”description”>’ . do_shortcode(wpautop(wptexturize($post->post_excerpt))) . ‘</div>’;
    }
    }

    #1338975

    Okay, so I have been digging into this more and more. Does Enfold save the short description field in a different place, like it does for post content in the meta table?

    #1339266

    Hi,

    Thank you for the update.

    The theme doesn’t alter the product description in any way as far as we know. You can check the enfold/config-woocommerce/config.php file to view the theme modifications for the shop plugin.

    Where can we check the issue? Please provide the product URL in the private field.

    Best regards,
    Ismael

    #1340327

    Thank you again. I think it was a plugin conflict, even though it should not have been.

    So, I took your suggested code for adding the subnavbar to the shop pages global, as it looks more in line with the client’s content site. It looks nice, but has an odd issue on the store main page — it kicks the sidebar down below the product loop. Am I missing something obvious to avoid this? Here is the code I adapted from your’s.

    add_action(“woocommerce_before_main_content”, function() {
    $menu = do_shortcode(“[av_submenu which_menu='' menu='23' position='center' sticky='aviaTBsticky' color='footer_color' mobile='disabled' mobile_switch='av-switch-768' alb_description='' id='subnav' custom_class='subnav' template_class='' av_uid='av-ndlzm' sc_version='1.0'] [av_submenu_item title='Menu Item 1' button_style='' link='' linktarget='' av_uid='av-gg26y' sc_version='1.0'] [av_submenu_item title='Menu Item 2' button_style='' link='' linktarget='' av_uid='av-ba2z6' sc_version='1.0'][/av_submenu]“);
    echo “<div class=’av-shop-sub-nav’>” . $menu . “</div>”;
    }, 10);

    Beyond the sidebar issue, it brings me to wonder if there would be any way to achieve this as the primary navbar? I have tried and as you know with all the sites we do, we have experimented with lots of designs and customizations. But, what is getting me is how to have two separate color sections: one for the header and one for the navbar. It sounds easy, and maybe it is, but for the life of me, the process is eluding me.

    Any ideas?

    Thanks again for all of the help!
    -jason

    #1341254

    Hi,

    it kicks the sidebar down below the product loop. Am I missing something obvious to avoid this? Here is the code I adapted from your’s.

    Sorry for the delay. We are not seeing this issue on our end. The sidebar is perfectly positioned beside the content even though the fixed submenu is there. Would you mind providing a screenshot?

    Best regards,
    Ismael

    #1343910

    I had to do a bunch of css work to fix the issue.

    I still would be very interested in seeing a method to accomplish this as a main menu, rather than as a shortcode attached subnavbar element. Can there be some consideration for making the main nav its own for formatting? Currently, it resides within the Header element, which means it affects the entire header along with the navbar. For those using navbars below the logo, it would be really useful to be able to style that element on its own.

    Hope this helps!
    -jason

    #1344556

    Hi,

    Glad to know that you managed to find a css solution. Unfortunately, these kind of changes will require significant amount of modifications. Please keep the css changes for now.

    Thank you for your patience.

    Best regards,
    Ismael

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