Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1077322

    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

    • This topic was modified 5 years, 8 months ago by Pcsanady.
    #1078262

    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

    #1078688

    fixed!!, tank you :D

    #1078720

    Hi,

    You are welcome! Let us know if you have any other questions or issues :)

    Best regards,
    Yigit

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Easy Slider + Last Post, is it possible??’ is closed to new replies.