Last active
May 19, 2017 16:39
-
-
Save fahmi182/775ff16775bd90c9e6b6e35f6fa5b4c2 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 | |
function baca_lagi($atts){ | |
//global $post; | |
$output = ''; | |
extract( shortcode_atts( array( | |
'ids' => null, | |
), $atts ) ); | |
$id_array = explode(',', $ids); | |
$id_implode = implode(',',$id_array); | |
$args = array( | |
'post_type' => 'post', | |
'include' => $id_implode, | |
'orderby' => 'post__in', | |
); | |
$post = get_posts( $args ); | |
if ( !empty( $post ) ) { | |
foreach ( $post as $posts ) { | |
$output .= '<a href="'. post_permalink( $posts->ID ) .'" class="bacajuga" target="_blank"><span class="bacaimg">'.get_the_post_thumbnail( $posts->ID, array( 100, 50) ).'</span><span class="bacajudul"><span class="bacablack">Baca juga:</span> '. $posts->post_title .'</span></a>'; | |
} | |
} | |
//wp_reset_postdata(); | |
return $output; | |
} | |
add_shortcode('bacalagi','baca_lagi'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment