Community Forums › Forums › Archived Forums › General Discussion › Add Shortcode below #inner div
- This topic has 4 replies, 2 voices, and was last updated 11 years, 1 month ago by jiversen.
-
AuthorPosts
-
March 25, 2013 at 3:10 pm #31179jiversenMember
Hi Guys,
maybe someone can assist in explaining the proper way to add a some minor HTML and a shortcode either below the #inner div section or above the #footer-widgets section.
I was able to use the Simple Hooks widget to add a Gravity form below the #header section, but with the modern portfolio theme, there is a #footer-widgets section above the #footer area, so I am unable to do the same thing above the #footer-widgets section (basically there are no hooks for #footer-widget or #inner in the simple hooks plugin).
So, would I add this to the functions.php section? If so how do I go about doing that, and will that area have any problem accepting a shortcode? Otherwise, would it be better to register a widget area and add the shortcode to the new widget section? If that is the case what is the best way to position that above the #footer-widgets section (or below the #inner).
The development server is located at: http://ssdi.projectviewing.com if you would like to view.
Thank you in advance,
Jordan
March 26, 2013 at 5:05 am #31270Brad DaltonParticipantUse the Simple Hooks plugin and paste the shortcode and HTML directly into the hook location or add a custom function to your child themes functions.php file.
Sample Code: https://gist.github.com/braddalton/5244584
The only problem is it might not be the location you want so its probably better to create a widget area which you can target using CSS code.
Sample code: https://gist.github.com/braddalton/5211317
If you add a widget using this code, you'll also need to add support for shortcodes in widgets:
add_filter( 'widget_text', 'shortcode_unautop'); add_filter( 'widget_text', 'do_shortcode');
March 26, 2013 at 1:14 pm #31383jiversenMemberHi Brad,
Thanks for the reply.
Adding widgetized areas seemed to be the best course of action for what I wanted to do. That said, I am running into an issue where it is adding an additional #inner section, and I am unaware why.
Here is the code that I added:
/** Register top form widget */
genesis_register_sidebar( array(
'id' => 'topform',
'name' => __( 'Top Form', 'mp' ),
'description' => __( 'Section for the top form', 'mp' ),
) );add_action( 'genesis_after_header', 'custom_after_header', 11 );
function custom_after_header() {
genesis_widget_area( 'topform', array(
'before' => '',
) );
}/** Register bottom form widget */
genesis_register_sidebar( array(
'id' => 'bottomform',
'name' => __( 'Bottom Form', 'mp' ),
'description' => __( 'Section for the bottom form', 'mp' ),
) );add_action( 'genesis_before_footer', 'custom_before_footer', 9 );
function custom_before_footer() {
genesis_widget_area( 'bottomform', array(
'after' => '',
) );
}
Thoughts?
March 26, 2013 at 1:16 pm #31384jiversenMemberThat stripped out my html, so here is link to pastebin: http://pastebin.com/MXr20YfL
March 26, 2013 at 1:38 pm #31390jiversenMemberOk, I figured it out. I thought the Before and After were identifying the Div's that it would come before or after, not adding HTML before or after.
Cheers,
Jordan
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.