Support » Theme: Storefront » Problem order by categories in home page

  • Resolved guidomix

    (@guidomix)


    Hi everybody,
    i have an issue to order my categories in home page.
    I hae this code:
    `if ( ! function_exists( ‘storefront_product_categories’ ) ) {
    /**
    * Display Product Categories
    * Hooked into the homepage action in the homepage template
    *
    * @since 1.0.0
    * @param array $args the product section args.
    * @return void
    */
    function storefront_product_categories( $args ) {

    if ( storefront_is_woocommerce_activated() ) {

    $args = apply_filters( ‘storefront_product_categories_args’, array(
    ‘limit’ => 5,
    ‘columns’ => 5,
    ‘child_categories’ => 0,
    ‘orderby’ => ‘name’,
    /*’order’ => ‘desc’,*/
    ‘title’ => __( ‘Acquista per categoria’, ‘storefront’ ),
    ) );

    $shortcode_content = storefront_do_shortcode( ‘product_categories’, apply_filters( ‘storefront_product_categories_shortcode_args’, array(
    ‘number’ => intval( $args[‘limit’] ),
    ‘columns’ => intval( $args[‘columns’] ),
    ‘orderby’ => esc_attr( $args[‘orderby’] ),
    ‘parent’ => esc_attr( $args[‘child_categories’] ),
    ) ) );

    /**
    * Only display the section if the shortcode returns product categories
    */
    if ( false !== strpos( $shortcode_content, ‘product-category’ ) ) {

    echo ‘<section class=”storefront-product-section storefront-product-categories” aria-label=”‘ . esc_attr__( ‘Product Categories’, ‘storefront’ ) . ‘”>’;

    do_action( ‘storefront_homepage_before_product_categories’ );

    echo ‘<h2 class=”section-title”>’ . wp_kses_post( $args[‘title’] ) . ‘</h2>’;

    do_action( ‘storefront_homepage_after_product_categories_title’ );

    echo $shortcode_content;

    do_action( ‘storefront_homepage_after_product_categories’ );

    echo ‘</section>’;

    }
    }
    }
    }

    I need to variate orderby from name to something like ID or Date but nothing happens.
    I want to choose what to show in home page.

    Thanks in advance to who will answer.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.