-
AuthorPosts
-
December 9, 2017 at 10:19 am #886750
Hi,
i would place an widget area with Adsense code under my H1 Title under the big picture on every post on my website. How can i do this fast without editing every Post? The Widget Area should be placed in a color section because the width.
- This topic was modified 6 years, 11 months ago by aisukei.
December 9, 2017 at 12:28 pm #886798Hey aisukei,
We don’t have a built in hook for under the image on blog posts, but I can show you how to add one. You should be using a child theme so that on your next theme update you won’t loose this change. We will edit enfold/includes/loop-index.php so add a copy of this to your child theme folder.
First add this code to the end of your functions.php file in Appearance > Editor:add_action( 'ava_after_post_image', 'enfold_customization_post_widget_area' ); function enfold_customization_post_widget_area() { dynamic_sidebar( 'postwidget' ); }
And then navigate to Dashboard > Appearance > Widgets and create a new widget area named postwidget and add your widget to it.
Then go to enfold/includes/loop-index.php line 204 and add:do_action( 'ava_after_post_image' );
It should look like this:
We can’t place it inside a color section, but you shouldn’t need that to have the width, nor should you need any css, but if you do just let us know.Best regards,
MikeDecember 9, 2017 at 12:41 pm #886799I did everything you said but i cant see anything. The widget area should be placed under the H1 Title on every post.
December 9, 2017 at 1:51 pm #886814Hi,
I’m sorry, I read it as under the title and image, as in my screenshot, which is a blog post using the default editor. But now that I look closer, it looks like you are using the advanced editor for your posts. Is this true?
This solution won’t work for you because when you use the advanced editor none of the template is used, a blank template is used so we can’t target the title.
So in this case you will need to edit each page, adding the Adsense code in a code block element under the title.
Or you can edit each page and add the widget element under the title so in the future you will only need to edit the one widget to change all of the pages.Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.