Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

“ADDITIONAL CSS CLASS[ES]” no longer available on Query Loop block

  • Hi. I’ve used a trick I learned from this support team in a number of places. The trick is where you use a CSS class name assigned to a block to serve as a “trigger” in various filters, indicating that the filter should process whatever when the class is present, and ignore processing when the class is missing. See https://generate.support/topic/control-query-loop-block-with-postmeta-query-parameter/ for an example.

    Today I went and wrote this code:

    add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) {
        if ( ! is_admin() &&
             ! empty( $attributes['className'] ) &&
             strpos( $attributes['className'], 'af-query-loop-empbio-trigger' ) !== false ) {
            $new_query_args = [
                'meta_query' => [
                    [
                        'key'     => 'af_author',
                        'value'   => get_the_ID(),
                        'type'    => 'NUMERIC',
                        'compare' => '=',
                    ]
                ]
            ];
    
            $query_args = array_merge( $query_args, $new_query_args );
        }
    
        return $query_args;
    }, 10, 2 );

    …and when I went to assign a CSS class of “af-query-loop-empbio-trigger” to the Query Loop block, I discovered that the “Advanced” section was empty, no longer exposing the “ADDITIONAL CSS CLASS[ES]” field.

    I can understand why this might have been done, after all, you don’t apply CSS to the Query Loop block itself. But what about those of us who have followed your lead with this technique? What are we to do now? Do you have an alternative technique you can recommend?

  • Oops…nevermind. The class is supposed to be applied to the Grid block child of the Query Loop block. Sorry for the commotion! Case closed.

  • No Problem 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.