Cyber Week Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Resolved] how to add widget after posts?

Home Forums Support how to add widget after posts?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #169203
    Dmitry Bychenko

    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?

    #169229
    Adrian Cojocariu

    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.

    #169370
    Tom
    Lead Developer
    Lead Developer

    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.

    #169475
    Dmitry Bychenko

    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)

    #169493
    Adrian

    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 🙂

    #169495
    Adrian

    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 !

    #169497
    Tom
    Lead Developer
    Lead Developer

    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 🙂

    #169503
    Dmitry Bychenko

    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&#8221; method=”post” target=”popupwindow” onsubmit=”window.open( ‘http://feedburner.google.com/fb/a/mailverify?uri=tradebonds&#8217;, ‘popupwindow’, ‘scrollbars=yes,width=550,height=520’);return true”>

    <label class=”sr-only”><span class=”screen-reader-text”>Email Subscription</span></label><input class=”form-control search-field” type=”text” value=”Ваш Email” onfocus=”if(this.value==’Ваш Email’)this.value=”;” onblur=”if(this.value==”)this.value=’Ваш Email'” name=”email”>

    <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.

    #169504
    Adrian

    Click the enable PHP button under the Hook in Generate Hooks.

    #169507
    Dmitry Bychenko

    My fault, i forgot to check Execute PHP.

    Thanks!

    • This reply was modified 4 years, 10 months ago by Dmitry Bychenko.
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.