• Resolved gverhaeg

    (@gverhaeg)


    Hello,

    I would like to find the number of testimonials waiting for moderation via a shortcode.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi.

    You can use this code:

    add_shortcode( 'testimonial_pending_count', 'wpmtst_testimonial_pending_count' );
    function wpmtst_testimonial_pending_count( $atts ) {
    
    	$args = array(
    		'post_type'      => 'wpm-testimonial',
    		'post_status'    => 'pending',
    		'posts_per_page' => -1,
    	);
    
    	$testimonials = get_posts( $args );
    
    	return count( $testimonials );
    }

    Then place the shorcode on a page with [testimonial_pending_count]

    Thread Starter gverhaeg

    (@gverhaeg)

    Hi,
    thanks for your support.

    I do not know php and so where do I add your code. In which module?

    Plugin Author Cristian Raiber

    (@cristianraiber-1)

    @gverhaeg – you should add that code inside your theme’s functions.php file.

    Alternatively, you could create a plugin just for this: https://www.wpbeaverbuilder.com/creating-wordpress-plugin-easier-think/

    Thanks,
    /Cristian.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘strong-testimonials’ is closed to new replies.