I have added a function in functions.php how can i make that function as short code?
function the_top_qa_users(){
global $wpdb;
echo "<h3>Popular Users</h3>";
$results = $wpdb->get_results( "SELECT * FROM $wpdb->usermeta WHERE meta_key='_qa_rep' AND meta_value > 0 ORDER BY CONVERT(meta_value, SIGNED) DESC LIMIT 0 , 5");
foreach ( $results as $result ) {
the_qa_user_link( $result->user_id );
echo get_avatar($result->user_id);
}
}
and in my page.php i called like <?php if(is_page('Home')) { the_top_qa_users();} ?>
how can i make a short code for this?
Try like this:
Access it Just type
[foobar]
into your editor and WordPress will dynamically replace the text as needed.