Add Shortcode below #inner div

Community Forums Forums General Discussion Add Shortcode below #inner div

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  jiversen 1 year, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31179

    jiversen
    Participant
    Post count: 10

    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

    #31270

    braddalton
    Participant
    Post count: 10675

    Use 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:
    [php]
    add_filter( ‘widget_text’, ‘shortcode_unautop’);
    add_filter( ‘widget_text’, ‘do_shortcode’);
    [/php]


    #31383

    jiversen
    Participant
    Post count: 10

    Hi 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?

    #31384

    jiversen
    Participant
    Post count: 10

    That stripped out my html, so here is link to pastebin: http://pastebin.com/MXr20YfL

    #31390

    jiversen
    Participant
    Post count: 10

    Ok, 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

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.