Hi, I’m in love with every single thing of this theme but here’s my question, i’ve created a full witdh slider, in witch i would like to have 5 slides(no problem with this) and on 3 of them I would like to display the title of the last post on a particular category(this is my problem), show me the way master :3
Hey Pcsanady,
Please try adding following code to Functions.php file of your child theme
function av_get_most_recent_post_title( $args ) {
$args = array( 'numberposts' => '1', 'category' => 14 );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){
echo '<span class="slider-post-title">'.$recent["post_title"]."</span>";
}
wp_reset_query();
}
add_shortcode( 'most_recent_post_title', 'av_get_most_recent_post_title' );
and change category ID (“14” in this example) to match your category ID and use following shortcode to display the title of your most recent post in selected category
[most_recent_post_title]
Best regards,
Yigit
fixed!!, tank you :D