Home Forums Space themes support forum Sticky Reaveal Footer

Sticky Reaveal Footer

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #639029

    sotiris
    Participant

    Hi,
    1.
    I want to create a footer reveal on scroll.
    In order to do this I need to increase the Z index of the sections of the site. I tried using a negative Z index for the footer but it wont work. Can you instuct me on how to adjust the Z index of sections that are in the shop page i.e. the Ajax shop element?
    2. Is there a way to make Ajax shop “ALL” tab display the products in randor order like in the woodmart theme ?
    Regards,
    Sotiris

    #639105

    Luke Nielsen
    Keymaster

    Hello,

    1. You need to use the CSS property Z-Index and put Position different from Static for the desired selector, for example:

    .xts-site-content {
        position: relative;
        z-index: 2;
    }
    
    .xts-footer {
        position: relative;
        z-index: 1;
    }

    2. Rand products:

    if ( ! function_exists( 'xts_random_order_for_products' ) ) {
       function xts_random_order_for_products( $query ) {
          if ( ! is_admin() && $query->is_main_query() && ( $query->is_post_type_archive( 'product' ) || $query->is_tax( 'product_cat' ) ) ) {
              $query->set( 'orderby', 'rand' );
          }
       }
       add_action( 'pre_get_posts', 'xts_random_order_for_products' )
    }

    Kind Regards

    #640437

    sotiris
    Participant

    Hi,
    2. What is the correct way to add the code, my attempt resulted in complete failure.

    Regars,
    Sotiris

    #640445

    Luke Nielsen
    Keymaster

    Hello,

    2. Paste the code to the functions.php file in your child theme.

    Kind Regards

    #640498

    sotiris
    Participant

    I get a syntax error. Please advice.

    Attachments:
    You must be logged in to view attached files.
    #640542

    Luke Nielsen
    Keymaster

    Hello,

    After the add_action( 'pre_get_posts', 'xts_random_order_for_products' )you need to define ; the semicolon. Then it will work.

    We have fixed that on your end, so clear the cache and recheck the issue.

    Kind Regards

    #640548

    sotiris
    Participant

    Thanks, it works but I now get duplicates. I purged all from lightspeed, I cleared cache of Chrome and also from Hostinger. Hostinger also has an “no cache preview” function which also has the duplicates problem.

    Attachments:
    You must be logged in to view attached files.
    #640812

    Luke Nielsen
    Keymaster

    Hello,

    Please replace the old custom with the below one to make the products random:

    if ( ! function_exists( 'xts_random_order_for_products' ) ) {
        function xts_random_order_for_products( $query ) {
            if ( ! is_admin() && $query->is_main_query() && ( $query->is_post_type_archive( 'product' ) || $query->is_tax( 'product_cat' ) ) ) {
                $random_key = get_transient( 'xts_random_order_key' );
    
                if ( false === $random_key ) {
                    $random_key = wp_rand( 1, 1000000 );
                    set_transient( 'xts_random_order_key', $random_key, HOUR_IN_SECONDS );
                }
    
                $query->set( 'orderby', 'rand(' . $random_key . ')' );
            }
        }
        add_action( 'pre_get_posts', 'xts_random_order_for_products' );
    }

    Kind Regards

    #640875

    sotiris
    Participant

    Hello,

    These got rid of the dublicates. The problem is that it produces exatcly the same result everytime. The products do not change order but are set in a particular order.
    I hope I am not asking too much is just that the point of the random order is to see different products first every time.

    Regards,
    Sotiris

    #640951

    Luke Nielsen
    Keymaster

    Hello,

    For Shop Page products, it will not work, delete that PHP code and use the Product Tabs element that has a Rand sorting option – https://monosnap.com/file/8GRCykmGxEqMMZ3aZVllqzNM3T7AtF

    Kind Regards

Viewing 10 posts - 1 through 10 (of 10 total)