Disable dynamic IDs in theme

Home Forums Jevelin Theme Disable dynamic IDs in theme

Home Forums Jevelin Theme Disable dynamic IDs in theme

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • cooltronic
    Participant

    Hello,

    I am using WP Rocket.

    I checked the IDs are dynamically generated, but I want them to be unique and static for ex. 24 hours for WP Rocket CSS optimization.

    How do achieve this?

    Also, I checked the plugins.css file, it has some parse errors.

    I fixed errors because when the CSS was processed by the RUCSS of the WP ROCKET algorithm it was broken. I am attaching a fixed file for you.

    cooltronic
    Participant

    I changed jevelin_rand() function.

    The many attributes were passed to the element so if we add the first 20 chars to the id of the attributes array it will be unique.

    Function inserted in helpers.php function jevelin_entity:
    <div>

     /**
    
      * Create Custom Random Function.
    
      */
    
     function jevelin_rand($length = 10)
    
     {
    
         return substr(str_shuffle(str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length);
    
     }
     //function which returns first 20 chars of string, typically $atts from each element
     function jevelin_entity($className)
    
     {
    
         return substr(preg_replace('/\W+/', '', strtolower(strip_tags(implode('_', $className)))), 0, 20);
    
     }

    </div>
    The first characters are given when we use instead of jevelin_rand(), the new function generates static assigned unique IDs names, but we must pass $atts in each element.

    Example of use in elements instead of rand:
    <div>

    $id = 'sh-text-group-'.jevelin_entity($atts);

    <div>

    $element_id = 'vc_column_'.jevelin_entity($atts);

    </div>

    </div>

    Shufflehound
    Moderator

    Hi there,

     

    Thank you for letting this know. 🙂

    At the moment we are not sure if need to help on something further for this topic.

     

    Best regards,

    Shufflehound team

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