-
-
Save theukedge/9f71966f9db3790f1e4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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