How-to use a shortcode in a page or post title
-
Hello!
I want to use different shortcodes in a page or posttitle
Total comment count;
function comment_count() { global $wpdb; return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = 1"); }
add_shortcode('commentcount', 'comment_count');
And Total post count;
function post_count() { global $wpdb; return $wpdb->get_var("SELECT count(id) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'"); }
add_shortcode('postcount', 'post_count');
I know I need do something with filters? Can somebody help me with this question?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘How-to use a shortcode in a page or post title’ is closed to new replies.