Tagged: blog categories, fullwidth submenu
-
AuthorPosts
-
January 11, 2017 at 2:09 pm #732049
I’m trying to apply a fullwidth submenu with my blog categories to all my blog pages (i.e. not just the main blog page where the submenu was made but all the individual pages and all the category filtered pages). I haven’t been able to find a clear solution on the forum. Presumably there isn’t a way to do this in the theme itself. Is there a way I can add something to my Childtheme’s function.php to enable it?
Cheers!
Thomas
January 13, 2017 at 3:47 pm #733163Anyone out there?
January 16, 2017 at 3:50 am #733849Hi,
Thank you for using Enfold.
You have to modify the archive.php template file if you want to add the submenu element in the category pages. Use the do_shortcode function in combination with the full width sub menu element shortcode.
// https://developer.wordpress.org/reference/functions/do_shortcode/
Example:
echo do_shortcode("[av_submenu which_menu='center' menu='' position='center' color='main_color' sticky='true' mobile='disabled' mobile_submenu=''][av_submenu_item title='Menu Item 1'][av_submenu_item title='Menu Item 2'] [/av_submenu]");
Best regards,
IsmaelJanuary 18, 2017 at 11:23 am #735245Thanks Ismael. I’m not that experienced with php, where should I place the code exactly in the archive.php file? Wherever I place it at the moment it is showing an error (even before i’ve added the shortcode for the submenu)? Thanks for your help. Thomas
January 22, 2017 at 9:52 am #736918Hey!
Instead of editing the archive.php file, please add this hook in the functions.php file.
add_action('ava_after_main_title', 'ava_after_main_title_mod'); function ava_after_main_title_mod() { if(is_archive()) { echo do_shortcode("[av_submenu which_menu='center' menu='' position='center' color='main_color' sticky='true' mobile='disabled' mobile_submenu=''][av_submenu_item title='Menu Item 1'][av_submenu_item title='Menu Item 2'] [/av_submenu]"); }
Cheers!
IsmaelJanuary 22, 2017 at 2:19 pm #736954Thanks Ismael,
i tried adding that to my child theme’s function.php file and it’s showing as having a syntax error on the last line? Any ideas?
Thanks again!
ThomasJanuary 22, 2017 at 3:51 pm #736968Hi!
add_action('ava_after_main_title', 'ava_after_main_title_mod'); function ava_after_main_title_mod() { if(is_archive()) { echo do_shortcode("[av_submenu which_menu='center' menu='' position='center' color='main_color' sticky='true' mobile='disabled' mobile_submenu=''][av_submenu_item title='Menu Item 1'][av_submenu_item title='Menu Item 2'] [/av_submenu]"); } }
Try it like that, let us know if it works.
Regards,
BasilisJanuary 22, 2017 at 4:27 pm #736972Great. Thank you so much. That worked perfectly!
It’s showing on the other category pages but is there a way to also have a submenu at the top of the individual article’s page. I also noticed that the individual articles’ permalinks don’t have the section name in front of the article title, so in my case “journal”. Is there a way to implement these?
Thanks again.
ThomasJanuary 22, 2017 at 5:48 pm #736987Hi!
That goes a lot far away from the support we can offer.
Please do consider if you still need that to hire someone who will help you get it further.Thanks a lot for your understanding and patience
Best regards,
Basilis -
AuthorPosts
- You must be logged in to reply to this topic.