Edidgegurlelt
New Member
I'm coding my first WP shortcode and am having trouble turning my working PHP into a working shortcode. I have successfully created a basic shortcode that returns text in the spot I'd like so that much is good. But I'm not doing so well putting the chocolate in the peanut butter. Here's what I have for the working PHP:\[code\]<div class="authorsocial"> <h5>Connect, Share & Follow</h5> <ul> <?php $meta_socialgr = apply_filters('the_content', get_post_meta($post->ID, 'author_goodreads', true)); if (!empty($meta_socialgr)) { ?> <li><a href="http://wordpress.stackexchange.com/questions/51840/<?php echo get_post_meta( $post->ID,'author_goodreads', true );?>"><img src="http://fiddlehead.milkbossindustries.com/files/goodreads.jpg"></a></li> <?php } ?> </ul></div><!-- end authorsocial --> \[/code\]And here is my basic shortcode:\[code\]<?php// Adding a shortcode to return each author's social media links function funcauthor_social( $atts ){ $output = 'bubbalicious'; return $output; } add_shortcode( 'author_social', 'funcauthor_social' );?>\[/code\]I'm not having much success in replacing "bubbalicious" with my functions as I'm just not grasping...something.\[code\]<?php// Adding a shortcode to return each author's social media links function funcauthor_social( $atts ){ $output = '<div class="authorsocial"> <h5>Connect, Share & Follow</h5> <ul>'.$meta_socialgr = apply_filters('the_content', get_post_meta($post->ID, 'author_goodreads', true)); if (!empty($meta_socialgr)) { ' <li><a href="'.echo get_post_meta( $post->ID, 'author_goodreads', true );.'"><img src="http://fiddlehead.milkbossindustries.com/files/goodreads.jpg"></a></li>'.}.' </ul> </div>'; return $output; } add_shortcode( 'author_social', 'funcauthor_social' ); ?>\[/code\]