• Im attempting to create a page that shows 2 things, using summarize posts. However, I need to figure out how to use the summarize post filters to filter for more than one possible value for that custom field. Basically a “Include any entries of custom_field where the value is either A, J, F, and T, than display it.”

    Currently I can get both conditions met through *seperate* [summarize-post] shortcodes, but I suppose I wonder if I can combine it into one. Anyone know a way to do this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Shortcodes offer only limited filters — you can do this via the PHP alternatives, however. See https://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_posts#Operators

    E.g.

    $args = array();
    $args['post_type'] = 'something';
    $args['my_field'] = array('A','J','F','T'); // will match any of these items
    // $args['my_field']['='] = array('A','J','F','T');  // more verbose option
    Thread Starter WebmistressM

    (@webmistressm)

    Oh this is very helpful for figuring out how to get real specific. I need to control this list quite a bit more than I think is sane but Im trying to single out some and then place them back into another list element below the first array.

    So where would these $arg = array () go? , a template page that I call within that page?

    The $args would be passed to GetPostsQuery::get_posts() as shown in https://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_posts_examples

    It would need to go in a template file, e.g. dedicate a template file for that page. Or if you wanted, you could put the GetPostsQuery call inside a PHP Snippet (https://www.ads-software.com/plugins/php-snippets/)

    But you need the flexibility of PHP for this because the shortcode interface is quite limited by comparison.

    Thread Starter WebmistressM

    (@webmistressm)

    @fireproofsocks

    Thanks so much. I had originally thought of doing things this way but didnt know if the summarize posts (which has seen significant improvement since when I first started this project) was the more updated solution. I guess it was inevitable that I would do things through get_posts in a template file because I do need to filter the list a bit. Basically Im going to need the equivalent of an if/then/else statement so that the get posts filters out any of my custom post entries which have either of the 3 checkboxes (from a multi select custom field) checked.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Summarize Posts (CCTM)’ is closed to new replies.