Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adding Double Rectangular Widgets After Post in Minimum
Tagged: adsense, minimum, widgets, widgets after content
- This topic has 4 replies, 1 voice, and was last updated 10 years, 10 months ago by eluviis.
-
AuthorPosts
-
April 22, 2013 at 4:14 pm #36981eluviisMember
I have seen a number of tutorials on how to add widgets after post. I'm currently using one hold a subscribe form like on Brian Gardner's tutorial.
But, what if I wanted to add two 336px square widgets side by wide, right after the post content in the content column. The cotent column in minimum fits up to 740px, so a pair of 336px boxes should be fine with room for padding to spare.
I'd rather they be 2 widgets so that I can easily replace content. One will contain an Adsense ad and the other would contain an image banner likely with a link to an article or page I would like to promote periodically.
Here is a perfect example of how I would like the boxes to look:
http://dannycruz.com/forums/tech/widgets_sample.jpg
And below is a post sample that would contain the boxes.
http://rallyways.com/2450/bella-italia-exotic-car-show-in-san-diego-california/April 22, 2013 at 4:49 pm #36995eluviisMemberI suppose the code needed for those two boxes would be similar to that of the eNews widget. Right now I'm using this code to register the eNews email sign up widget and display it:
//** Register newsletter signup widget area for the after post content form */
genesis_register_sidebar( array(
'id' => 'newsletter',
'name' => __( 'Newsletter After Post', 'custom-theme' ),
'description' => __( 'This is the newsletter section.', 'custom-theme' ),
) );/** Display newsletter signup widget after the post content */
add_action( 'genesis_after_post_content', 'custom_add_newsletter_box' );
function custom_add_newsletter_box() {
if ( is_singular( 'post', 'quickblog' ) )
genesis_widget_area( 'newsletter', array(
'before' => '',
) );
}And for styling it I'm using this:
/* Search Form / eNews and Update Widget
------------------------------------------------------------ */.enews-widget {
background-color: #333333;
line-height: 1.5;
margin: 11px 0px 0px 0px;
padding: 2.5rem 3rem 3rem;
}.enews #subbox, #subbox1, #subbox2, .s {
-moz-box-shadow: 0 0 5px #ccc inset;
-webkit-box-shadow: 0 0 5px #ccc inset;
background-color: #fff;
border: 1px solid #ccc;
box-shadow: 0 0 5px #ccc inset;
box-sizing: border-box;
color: #999;
font-family: 'Open Sans', sans-serif;
font-size: 12px;
line-height: 1.5;
padding: 15px;
text-transform: uppercase;
width: 50%;
}#nav .searchform {
margin: 3px 0 0;
}.enews .searchsubmit {
display: none;
}.enews p {
margin: 0 0 10px;
color: #ffffff;
}.enews h4 {
margin: 0 0 10px;
color: #CAAD23;
}-----------------------------
Now, using those 2 snippets as samples, how do I create my 2 side by side 336px widgets after the content, but before the signup form, and style them to sit side by side?
April 30, 2013 at 4:25 pm #38645eluviisMemberAnybody feeling helpful?
May 14, 2013 at 2:33 pm #40908eluviisMemberAfter much trial and error, this is the code I used to display the 2 boxes:
`
/** Display custom content box 1 widget after the post content - Needs debugging */
add_action( 'genesis_after_post_content', 'add_custom_content_box_1' );
function add_custom_content_box_1() {
if ( is_singular( array( 'post', 'quickblog', 'specialty', 'show' ) ) )
genesis_widget_area( 'custom-content-box-1', array(
'before' => '<div id="custom-content_box_1 widget-area">',
) );
}/** Display custom content box 2 widget after the post content - Needs debugging */
add_action( 'genesis_after_post_content', 'add_custom_content_box_2' );
function add_custom_content_box_2() {
if ( is_singular( array( 'post', 'quickblog', 'specialty', 'show' ) ) )
genesis_widget_area( 'custom-content-box-1', array(
'before' => '<div id="custom-content-box-2 widget-area">',
) );
}`
Unfortunately, it's not working right. The boxes display... but what happens is, whatever I put in the first widget gets repeated in the 2nd widget.
I've tried to contract some people to hire them to help me debug this, but everyone's super busy.
May 14, 2013 at 2:36 pm #40909eluviisMemberI also don't understand why pasting the code here strips out some of the code. Whether I use the code tags or not. (There should be more code on after the 'before' that gets stripped out when I post it here. This is so frustrating. I'm going to be giving this one up soon...
EDIT: There. I finally got it to display all the code.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.