• Resolved amit.erandole

    (@amiterandole)


    Hi,

    I am trying to embed a poll daddy plugin into my wordpress sidebar.php so it can show against each poll in single.php:

    <?php if ( get_post_meta($post->ID, 'Poll Daddy Poll ID', true) ) : ?>
         <div id="poll-side">
         <?php $pollId = get_post_meta($post->ID, 'Poll Daddy Poll ID', true); ?>
        <?php echo do_shortcode($pollId); ?>
        </div>
    <?php endif; ?>

    I have setup a custom field and stored the value on it. If I just echo out the raw value, it does that but the code above should be rendering the poll. What am I doing wrong?

Viewing 1 replies (of 1 total)
  • Jerimee

    (@jerimee)

    Your code totally worked for me. I appreciate you posting the code. Hope you figured out what was going wrong.

    $thepdcode = get_post_meta($post->ID, 'pdcode', true);
                      if ($thepdcode){
                      	?><div style="padding-bottom:20px;"><?php
                      	$pattern = '/[a-zA-Z]/';
                      	//preg_match($pattern, $meta)
                        if (preg_match($pattern, $thepdcode)){
                        	print "<!-- pd wp shortcode -->";
                        	echo do_shortcode($thepdcode);
                        } else {
                          //pdcode: incorrect syntax
                        }
                        ?></div><?php
                      } else {
                      	//pdcode: missing
                      }
Viewing 1 replies (of 1 total)
  • The topic ‘Embedding polldaddy poll in single.php sidebar’ is closed to new replies.