Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other WordPress Shortcode Madness!!

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #38300

    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)
  • The forum ‘Other’ is closed to new topics and replies.