Display latest 5 posts on homepage
The issue is with your $limit var, you can’t set a default value like that because WordPress overwrites it with an empty value. Check out the Shortcode API for the correct way to pass and set shortcode attributes. function custom_prev_posts( $atts ){ extract( shortcode_atts( array( ‘limit’ => 5 ), $atts ) ); // the rest … Read more