Community Forums › Forums › Archived Forums › Design Tips and Tricks › Newsletter widget after post Genesis 2.0
- This topic has 16 replies, 5 voices, and was last updated 11 years, 5 months ago by
kdmpublishing.
-
AuthorPosts
-
August 16, 2013 at 9:31 am #56811
Reginald
MemberHi 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.
Website | Facebook | Twitter | Google+ | Editorial Sumo
August 16, 2013 at 10:37 am #56830Brad Dalton
ParticipantThe code uses the old XHTML hooks so you need to replace:
genesis_after_post_content
With
genesis_entry_footer
Here's the working code with new HTML 5 hook
//* 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">', ) ); }
You can change the 5 to 15 if you want to move the box below the post meta.
August 16, 2013 at 11:59 am #56847Reginald
MemberHi 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.
Website | Facebook | Twitter | Google+ | Editorial Sumo
August 16, 2013 at 12:04 pm #56848Brad Dalton
ParticipantThe name of the function and a unique i.d:
//* 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">', ) ); }
August 16, 2013 at 2:52 pm #56895Jenny
MemberYay thank you for this. I finally got my related posts widget fixed *hugs*
August 16, 2013 at 3:06 pm #56902Brad Dalton
ParticipantAugust 16, 2013 at 7:31 pm #56951Reginald
MemberHey 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 🙂
Website | Facebook | Twitter | Google+ | Editorial Sumo
August 16, 2013 at 7:48 pm #56953Brad Dalton
ParticipantYou 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 .
August 16, 2013 at 7:55 pm #56955Reginald
MemberHi 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!
Website | Facebook | Twitter | Google+ | Editorial Sumo
August 16, 2013 at 8:15 pm #56960Brad Dalton
ParticipantThe 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:
<div id="custom"
To this in the code above
<div id="newsletter"
So here's the code now:
//* 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">', ) ); }
August 16, 2013 at 8:25 pm #56963Reginald
MemberHey 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?
Website | Facebook | Twitter | Google+ | Editorial Sumo
August 16, 2013 at 8:31 pm #56967Brad Dalton
ParticipantAugust 25, 2013 at 1:30 pm #58748[email protected]
Member@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).August 25, 2013 at 3:08 pm #58770Brad Dalton
ParticipantSeptember 4, 2013 at 9:29 am #60636kdmpublishing
Member@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
September 4, 2013 at 9:45 am #60644Brad Dalton
Participant@kdmpublishing Please send me a copy of your theme files and i'll test it. I do own that theme but maybe the new version is slightly different. [email protected]
September 4, 2013 at 11:40 am #60677kdmpublishing
MemberOnce I added in the updated code that you provided for the functions.php it worked fine. I set it up on my main site that uses the epik theme (v1.3) (see an example here http://wpclientsatisfaction.com/tips-plugin-developers/) and it worked. Now when I originally tried with the code on Brian's page, it didn't work on the Epik updated version.
Brian's code did however, work on the site that I use the Fabricated theme since that is not updated for html 5 (see example here http://quickstartminisites.com/home-decorating-niche-minisite/)
If you still need me to send you the functions file for Epik, sure just let me know.
Donesia Muhammad (kdmpublishing)
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.