• Resolved Krektor

    (@ffdltd)


    Hello!

    Firstly, thank you for this great plugin!

    I am attempting to display the count of a custom post type which has a specific custom field value.

    I was wondering if this was possible via this plugin?

    My custom post type would be ‘responses’

    The custom field within the post would be ‘attending’

    and the two custom field values would be ‘yes’ or ‘no’

    I’d like to display the number of posts that are a ‘yes’ and the number of posts that are a ‘no’, individually.

    If it is not possible, do you know if I can achieve this with a custom shortcode in my functions.php? I have been attempting this for a number of hours, with no luck so far.

    Thank you in advance for any help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Hi Krektor, glad to help:

    1) “I was wondering if this was possible via this plugin?”

    Currently no turn-key way of doing this with the plugin.

    2) “do you know if I can achieve this with a custom shortcode in my functions.php?”

    There is no shortcode or code provided with the plugin, however it may be possible to achieve if you’re familiar with code, using the following filter hook:

    sbs_posts_args

    That filters the arguments for get_posts(), located on line 170 in the main plugin file. With that filter it should be possible to use WP_Query meta parameters to get the required results. Note that I have not tried this and don’t have any code for it, just mentioning FYI.

    I hope this is useful, let me know if I can provide any further information.

    Thread Starter Krektor

    (@ffdltd)

    Wow Jeff, thanks for the super fast world record response.

    I have actually just managed to achieve this via a shortcode in my functions.php, despite hours of trying previous to opening this support query.

    Must be another case of ‘rubber duck debugging’ ??

    Thanks for your time, I appreciate it!

    Plugin Author Jeff Starr

    (@specialk)

    Awesome, glad you found a solution ??

    Cheers, Krektor.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Count of custom post types with specific custom field values?’ is closed to new replies.