Forum Replies Created

Viewing 1 replies (of 1 total)
  • I had a similar problem, and in the pattern menu I could see only 10 patterns.
    Even, when I searched for the specific pattern, if it was not in that list of 10 patterns it was not shown.

    Problem found:

    I have noticed that number of patterns shown is the same as the number set in the “Blog pages show at most” in the Settings -> Reading.

    @jimvail I guess you see only one pattern because you have set this to one (1).

    Where is the problem:

    In the plugin’s file: “block-pattern-builder/src/functions-paterns.php
    Line number’s: 52-55

    WP_Query is created in order to list all patterns:

    
    	$patterns = new WP_Query( [
    		'post_type'    => 'bpb_pattern',
    		'number_posts' => -1
    	] );
    

    Used attribute ‘number_posts‘ is wrong and does not exist in the list of attributes that WP_Query can have.

    So, in order to list all patterns, we can use:
    ( Source: https://developer.www.ads-software.com/reference/classes/wp_query/#pagination-parameters )

    
       'posts_per_page' => -1
    

    or, maybe better:

    
       'nopaging' => true
    

    So, we have to change the above code with the following one:

    
    	$patterns = new WP_Query( [
    		'post_type' => 'bpb_pattern',
    		'nopaging'  => true
    	] );
    

    And, the problem is solved. (At least, it works for me. ?? )

    @greenshady If you find that this is OK, would you like to update the plugin with this fix, please?

    Thanks,
    Tony M.

    • This reply was modified 3 years, 11 months ago by Tony M..
    • This reply was modified 3 years, 11 months ago by Tony M..
Viewing 1 replies (of 1 total)