Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter oscarasking

    (@oscarasking)

    Ok, thanks Harish

    Thread Starter oscarasking

    (@oscarasking)

    Hi Harish,

    I was thinking of a PHP-based solution, but CSS might work for me in this case.

    Thanks!

    Thread Starter oscarasking

    (@oscarasking)

    @trogau, thanks for the tip. It worked for me too. Since it is a staging site, I don’t need to have the ban lists enabled neither.

    I am interested too if anyone has any ideas, without disabling this option.

    Thanks!

    Hi @vectyr,

    You can do so with array_unshift php function. According to the documentation, you can do something like this:

    function my_plugin_block_categories( $categories, $post ) {
      if ( $post->post_type !== 'page' ) {
        return $categories;
      }
      $custom_category_one = array(
        'slug' => 'category-dr',
        'title' => __( 'DragonRidge Blocks', 'my-plugin' ),
        //'icon'  => 'admin-home',
      );
      $custom_category_two = array(
        'slug' => 'dr-dashboard',
        'title' => __( 'DragonRidge Dashboard', 'my-plugin' ),
        //'icon'  => 'admin-home',
      );
      $custom_category_three = array(
        'slug' => 'category-home',
        'title' => __( 'DragonRidge Home Page', 'my-plugin' ),
        //'icon'  => 'admin-home',
      );
    
      array_unshift( $categories, $custom_category_one, $custom_category_two, $custom_category_three );
      return $categories;
    }
    add_filter( 'block_categories', 'my_plugin_block_categories', 10, 2 );

    And you will get this result:

    Array
    (
        [0] => Array
            (
                [slug] => category-dr
                [title] => DragonRidge Blocks
                [icon] => admin-home
            )
    
        [1] => Array
            (
                [slug] => dr-dashboard
                [title] => DragonRidge Dashboard
                [icon] => admin-home
            )
    
        [2] => Array
            (
                [slug] => category-home
                [title] => DragonRidge Home Page
                [icon] => admin-home
            )
    
        [3] => Array
            (
                [slug] => text
                [title] => Text
                [icon] => 
            )
    
        [4] => Array
            (
                [slug] => media
                [title] => Media
                [icon] => 
            )
    
        [5] => Array
            (
                [slug] => design
                [title] => Design
                [icon] => 
            )
    
        [6] => Array
            (
                [slug] => widgets
                [title] => Widgets
                [icon] => 
            )
    
        [7] => Array
            (
                [slug] => embed
                [title] => Embeds
                [icon] => 
            )
    
        [8] => Array
            (
                [slug] => reusable
                [title] => Reusable Blocks
                [icon] => 
            )
    )
    Thread Starter oscarasking

    (@oscarasking)

    Ok! Thank you very much Joy!

    Thread Starter oscarasking

    (@oscarasking)

    Hi, Joy!

    Suppose the following. I have an store with this categories:

    • Autumn Winter 19
    • Spring Summer 20
    • Men
    • Women
    • All products are well categorized. All products belongs to Men or Women, and all products belongs to one or another season.

      If I want to show products that belongs to SS20 and Women, for example, is there another way than writing example.com/product-category/ss20+women?? How would you do it? Is there a way to avoid this kind of urls with plus sign, but show products that belongs to those two categories at the same time?

      Thanks in advance!!

Viewing 6 replies - 1 through 6 (of 6 total)