-
AuthorPosts
-
August 2, 2018 at 6:27 pm #992954
I want to add a widget are for after my blog posts. Admittedly I’m I don’t totally understand Hooks and tried the below two codes with no luck
add_action(‘ava_after_content’, ‘custom_func_1’, 10, 2);
function custom_func_1() {
if(is_single()){
dynamic_sidebar( ‘after-post’ );
}
}THEN:
add_action(‘ava_after_content’,’avia_after_content’);
function avia_after_content(){
dynamic_sidebar( ‘after-post’ );
}August 4, 2018 at 6:52 pm #993559Hey Rgrant74,
If you add those sections on your functions.php file, then you need to go to Appearance -> Widgets
and from there use that sidebar to add anything you need.Best regards,
BasilisAugust 8, 2018 at 5:47 pm #995088This is what I did but the sidebar was not there in widgets. so I assumed I did it incorrectly and came here
August 9, 2018 at 10:34 am #995355Hi,
Thanks for the update. Did you enable the sidebar in the Enfold > Sidebar settings?
Best regards,
IsmaelAugust 9, 2018 at 11:21 am #995380hm isn’t the ava_after_content only for the loop – so if you have a blog style or look to a category list then the widget would be there.
but on a single-post there is no hook ava_after_contentPlease Ismael – correct if i’m wrong
btw. Rgrant74 – you have to create on appearance widgets the widget on Enfold Child Custom Widget Area – add widget area.
Your code is only to define the place where it is inserted.Maybe you can use a different hook for that – but you have to style that of course for your needs:
add_action( 'ava_before_footer', 'enfold_widget_before_footer_for_single_post' ); function enfold_widget_before_footer_for_single_post() { if(is_single()){ dynamic_sidebar( 'after-post' ); } }
and if you only wants it for single posts (not for portfolios):
add_action( 'ava_before_footer', 'enfold_widget_before_footer_for_single_post' ); function enfold_widget_before_footer_for_single_post() { if(is_singular(post)){ dynamic_sidebar( 'after-post' ); } }
to have the same dimensions as your content – look to your settings and add it for that widget-area to your quick css:
f.e.:.single #main .widget { max-width: 1310px; margin: 0 auto; padding: 0 50px; }
August 9, 2018 at 2:55 pm #995506Hi Rgrant74,
Have you followed Guenni007’s solution?
Thank you for your input, Guenni007.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.