Newsletter widget after post Genesis 2.0

Community Forums Forums Design Tips and Tricks Newsletter widget after post Genesis 2.0

This topic is: not resolved

This topic contains 16 replies, has 5 voices, and was last updated by  kdmpublishing 11 months, 4 weeks ago.

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #56811

    Reginald
    Participant
    Post count: 52

    Hi guys

    I have a question. I followed Brian’s guide here: http://www.briangardner.com/email-newsletter-signup-box/

    I can see the signup box on widget screen but the email box doesn’t show up on live page. I tested with different browsers (cleared cache too) but doesn’t seem to work.

    I am using Genesis Sample and with Genesis 2.0 and HTML5.

    Do you have any idea what is wrong? Here’s the link: http://www.reginaldchan.net/blogging-experience/

    Thank you.


    http://www.reginaldchan.net
    #56830

    braddalton
    Participant
    Post count: 9316

    The code uses the old XHTML hooks so you need to replace:
    [php]
    genesis_after_post_content
    [/php]

    With
    [php]
    genesis_entry_footer
    [/php]

    Here’s the working code with new HTML 5 hook
    [php]
    //* Register newsletter widget area
    genesis_register_sidebar( array(
    ‘id’ => ‘newsletter’,
    ‘name’ => __( ‘Newsletter’, ‘custom-theme’ ),
    ‘description’ => __( ‘This is the newsletter section.’, ‘custom-theme’ ),
    ) );

    //* Add the newsletter widget after the post content
    add_action( ‘genesis_entry_footer’, ‘custom_add_newsletter_box’, 5 );
    function custom_add_newsletter_box() {
    if ( is_singular( ‘post’ ) )
    genesis_widget_area( ‘newsletter’, array(
    ‘before’ => ‘<div id="newsletter">’,
    ) );
    }
    [/php]

    You can change the 5 to 15 if you want to move the box below the post meta.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #56847

    Reginald
    Participant
    Post count: 52

    Hi Brad,

    Thanks for that. I have another ‘stupid’ question I hope you don’t mind.

    What happens if I want to add another widget area below the newsletter box (above) but above the author box?

    Which part should I amend the code?

    Thank you so much for your assistance.


    #56848

    braddalton
    Participant
    Post count: 9316

    The name of the function and a unique i.d:
    [php]
    //* Register newsletter widget area
    genesis_register_sidebar( array(
    ‘id’ => ‘custom’,
    ‘name’ => __( ‘New Widget’, ‘custom-theme’ ),
    ‘description’ => __( ‘This is the new widget section.’, ‘custom-theme’ ),
    ) );

    //* Add the newsletter widget after the post content
    add_action( ‘genesis_entry_footer’, ‘custom_widget_box’, 8 );
    function custom_widget_box() {
    if ( is_singular( ‘post’ ) )
    genesis_widget_area( ‘custom’, array(
    ‘before’ => ‘<div id="custom">’,
    ) );
    }
    [/php]


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #56895

    Jenny
    Participant
    Post count: 37

    Yay thank you for this. I finally got my related posts widget fixed *hugs*

    #56902

    braddalton
    Participant
    Post count: 9316

    No worries Jenny.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #56951

    Reginald
    Participant
    Post count: 52

    Hey Brad,

    Thanks for that! One question (another). How to style the custom one?

    The newsletter one is:
    /*
    Newsletter
    ———————————————————— */

    #newsletter {
    background-color: #222;
    color: #fff;
    line-height: 1.5;
    padding: 32px;
    padding: 2rem;
    text-align: center;
    }

    #newsletter p {
    margin-bottom: 24px;
    margin-bottom: 1.5rem;
    }

    #newsletter input {
    width: 50%;
    }

    I can’t just change #newsletter to #custom right?

    Sorry if my question is a little misleading :)


    #56953

    braddalton
    Participant
    Post count: 9316

    You can use the same class to style both.

    This way you don’t need to duplicate the CSS.

    Or you can duplicate and modify the CSS and use the new class .


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #56955

    Reginald
    Participant
    Post count: 52

    Hi Brad

    Thanks for your quick reply.

    So I assume the class is newsletter and custom?

    Being said that (assuming it is correct), how can I style them both using the same css?

    Is it set as #newsletter #custom ?

    Again, I might sound stupid so, please bear with me :) Haha!


    #56960

    braddalton
    Participant
    Post count: 9316

    The CSS is already included in the style sheet for the newsletter selector so you can use it in your custom widget.

    No need to add any more CSS.

    Change this:
    [php]
    <div id="custom"
    [/php]

    To this in the code above

    [php]
    <div id="newsletter"
    [/php]

    So here’s the code now:
    [php]
    //* Register newsletter widget area
    genesis_register_sidebar( array(
    ‘id’ => ‘custom’,
    ‘name’ => __( ‘New Widget’, ‘custom-theme’ ),
    ‘description’ => __( ‘This is the new widget section.’, ‘custom-theme’ ),
    ) );

    //* Add the newsletter widget after the post content
    add_action( ‘genesis_entry_footer’, ‘custom_widget_box’, 8 );
    function custom_widget_box() {
    if ( is_singular( ‘post’ ) )
    genesis_widget_area( ‘custom’, array(
    ‘before’ => ‘<div id="newsletter">’,
    ) );
    }
    [/php]


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #56963

    Reginald
    Participant
    Post count: 52

    Hey mate!

    Thanks for that.

    Looks good. If I want to place it after post meta,

    I just change this:

    add_action( ‘genesis_entry_footer’, ‘custom_widget_box’, 8 );

    to

    add_action( ‘genesis_entry_footer’, ‘custom_widget_box’, 15 );

    right?


    #56967

    braddalton
    Participant
    Post count: 9316

    Spot on.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #58748

    arnold.watson@att.net
    Participant
    Post count: 1

    @Reginald: Thank you for posting this coding issue as I was experiencing the very exact problem.
    @Brad: You are awesome at what you do and very timely and prompt I might add. Thank you for the problem solving response(s).

    #58770

    braddalton
    Participant
    Post count: 9316

    You’re welcome Arnold.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #60636

    kdmpublishing
    Participant
    Post count: 2

    @braddalton, thank you for posting this fix. I was wondering why the code worked on my other sites that have themes that are not upgraded for html 5 and why it wouldn’t work on my site with the Epik Theme which is upgraded. Tried to add in the code a bunch of times, and couldn’t figure out why it didn’t work. I will keep both copies of the code depending on the studio press theme I have.

    Thanks again

Viewing 15 posts - 1 through 15 (of 17 total)

You must be logged in to reply to this topic.