Grow your CSS skills. Land your dream job.

WordPress Shortcode Madness!!

  • # May 31, 2012 at 4:36 pm

    Ok… back-story… I need to have dynamic modal dialog boxes. Click a word in a WordPress post and up pops a modal dialog with more information about that word. There are several of these in a page.

    My solution to this was to create a short code that references a post id to get the post content to put in the dialog when it pops up. I’m using the Foundation Theme from Zurb as a starter, and it includes modal dialog code.

    My issue, I’m getting random paragraph tags around my shortcode content. Can anyone tell me what I’m doing wrong????

    What I have in WordPress editor on that page:

    In order to develop a [PopUp id="1"]corporate compensation philosophy[/PopUp], total compensation must be

    What I have my functions.php file

    //Custom PopUp Shortcode for Modal Dialog hottness
    function PopUp($atts, $ShortcodeContent = null) {
    extract(shortcode_atts(array(“id” => ’5′), $atts));
    $content = parse_shortcode_content( $content );

    global $post;
    $post = get_post($id);
    $postSlug = the_slug($id);
    $myPostContent = $post->post_content;

    return ‘
    ‘ . $ShortcodeContent . ‘

    ‘ . $ShortcodeContent . ”. $myPostContent . ‘
    ‘;
    }
    add_shortcode(‘PopUp’, ‘PopUp’);

    End result of the above:

    http://www.ebs-consulting.com/Wordpress/consulting-services/human-resources/wage-and-salary-administration/

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".