Skip to content

Instantly share code, notes, and snippets.

@theukedge
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theukedge/9f71966f9db3790f1e4b to your computer and use it in GitHub Desktop.
Save theukedge/9f71966f9db3790f1e4b to your computer and use it in GitHub Desktop.
<?php
//shortcodes inside posts
function diww_include_post($atts) {
$thepostid = intval($atts[id]);
$output = '';
$post = get_post($thepostid);
if ($post) :
$output .= '<a href="' . the_permalink() . '">' . get_the_post_thumbnail($post->ID, 'large') . '</a>';
else :
// failed, output nothing
endif;
return $output;
}
add_shortcode('include_post', 'diww_include_post');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment