Archived topic
how to add widget after posts?
9 replies · Started by Dmitry Bychenko on January 31, 2016
Hello, guys,
I want to put subscription form after all posts. I mean subscription form to be put automatically after all posts, present and following.
I have this subscription form in right sidebar, it is put there as a widget FeedBurner Email Subscription.
I have this form in footer widget, its put there as a widget as well. easy.
The question is how to put this widget (FeedBurner Email Subscription 1.3.5) after all posts on the blog?
The thing is there is no widget area after the post.
How to get it done?
Hello. If you have the Generate Hooks addon, try going to the GP Hooks and add your subscription form in the After Content tab. Hope this works.
GP Hooks is definitely the way to go.
To make sure it only shows up on single posts, wrap it in this conditional:
<?php if ( is_single() ) : ?>
Your subscription form in here
<?php endif; ?>
Then make sure Execute PHP is checked.
Thanks, Adrian, Thanks, Tom.
Im not great in php, or whatever..
My subscription form is a Widget, i have no idea how to put Widget into After Content tab.
I guess you guys are talking about putting piece of code into After Content tab, not a widget itself.
How to get a code out from widget and put it into After Content tab?
(wrapped by this condition:
<?php if ( is_single() ) : ?>
Your subscription form in here
<?php endif; ?> thats fine, i understand this)
You can right click the form in the browser ( Chrome is best for this ) and then click inspect element.
You will then look around until you see the <form> tag, right click and click edit HTML, then copy the code there.
Make sure that you copy the entire form, meaning the text between <form> and </form>, including the <form> tags.
Paste that between the PHP tags in the Hooks, then try to rearange the HTML in case it does not look exactly as you want. It shouldn't be too hard to figure it out :)
I also forgot, don't inspect element for the form inside the WP Dashboard, inspect element for the form your visitors see on the website. That's the correct code you need. Good luck !
Hi there,
Adrian's method will work great.
One other option is to use this plugin: https://wordpress.org/plugins/widget-shortcode/
You can then insert the shortcode from your widget into GP Hooks.
Let me know :)
Thank you, guys,
That's what i got:
<?php if ( is_single() ) : ?>
<form class="fes fes-default" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open( 'http://feedburner.google.com/fb/a/mailverify?uri=tradebonds', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
<button type="submit" class="btn btn-default btn-submit">Подписаться</button><input type="hidden" value="tradebonds" name="uri"><input type="hidden" name="loc" value="en_US"></form>
<?php endif; ?>
But there is a problem:
this subscription form is visible from Main Page under all posts, under button Read more...
how to make this form to appear only when you go inside the post, after you press Read more..?
And NOT visible from main page.
Click the enable PHP button under the Hook in Generate Hooks.
My fault, i forgot to check Execute PHP.
Thanks!
