php - How to make Wordpress Short-code for recent posts -


i want create simple wordpress shortcode recent posts use inside post.

i know basic steps of creating shortcode:

1- open wp theme "functions.php" file , include new custom file created in same directory name "custom-shortcode.php"

2- inside "custom-shortcode.php" write actual code:

 <?php       // shortcode function     function custom_shortcode() {          // use wp recent posts function default values return         return php wp_get_recent_posts( $args, $output );     }     // add shortcode (wp function)     add_shortcode( 'recent-post', 'custom_shortcode' );   ?> 

i want use wp default function getting recent posts, code work? want shortcode minimal code , default values return can focus on learning how can make own shortcode.

use shortcode_atts(array( make custom style..

you can follow , http://codex.wordpress.org/shortcode_api


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -