Hi, I’m using DW Timeline (free version). This theme doesn’t support default widget. May I know how to add recent post to every post page?
Please login or Register to submit your answer
Hi, I’m using DW Timeline (free version). This theme doesn’t support default widget. May I know how to add recent post to every post page?
Please login or Register to submit your answer
replied 8 years ago
I try adding this code manually in every post I did but it won’t run the code.
<?php $recent_posts = wp_get_recent_posts();
foreach( $recent_posts as $recent ){
if($recent[‘post_status’]=="publish"){
if ( has_post_thumbnail($recent["ID"])) {
echo ‘<li style="padding:5px;border-bottom:1px solid goldenrod;">
<a href="’ . get_permalink($recent["ID"]) . ‘" title="Look ‘.esc_attr($recent["post_title"]).’" >’ . get_the_post_thumbnail($recent["ID"], ‘thumbnail’). $recent["post_title"].’ ‘;
}else{
echo ‘<li style="padding:5px;border-bottom:1px solid goldenrod;">
<a href="’ . get_permalink($recent["ID"]) . ‘" title="Look ‘.esc_attr($recent["post_title"]).’" >’ . $recent["post_title"].’ ‘;
}
}
}
?>
replied 8 years ago
Problem solved. I download and using this plugin -> https://wordpress.org/plugins/shortcode-exec-php/