Skip to content

Instantly share code, notes, and snippets.

@gicolek
Created March 18, 2013 17:02
Show Gist options
  • Save gicolek/5188813 to your computer and use it in GitHub Desktop.
Save gicolek/5188813 to your computer and use it in GitHub Desktop.
How not to code WP shortcodes
<?php
$output = '';
if ( $related_posts->have_posts() ){
$out .= '<h3> Related Posts</h3>';
$out .= '<ul>';
while ( $related_posts->have_posts() ){
$related_posts->the_post();
$out .= '<li><a href="'.the_permalink().'">'.get_the_title().'</a></li>';
}
$out .= '</ul>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment