I have developed a short code function in function.php. What I want to do is pass the argument to that short code function so it will fetch data from database based on some query using that argument. I just want to know how to pass argument. Like I have used short code on WordPress page.
How can I pass name of the page or static text argument to the short code function in PHP? For the time being I am fetching data by using static argument.
My short code function is:
function db_short() {
global $wpdb;
$result = $wpdb->get_results ( "SELECT * FROM interestclass where Subject='Bakery, Pastory & Cookies' " );
}
add_shortcode( 'show_db_info', 'db_short' );