Title: ThomDJ's Replies | WordPress.org

---

# ThomDJ

  [  ](https://wordpress.org/support/users/thomdj/)

 *   [Profile](https://wordpress.org/support/users/thomdj/)
 *   [Topics Started](https://wordpress.org/support/users/thomdj/topics/)
 *   [Replies Created](https://wordpress.org/support/users/thomdj/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/thomdj/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/thomdj/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/thomdj/engagements/)
 *   [Favorites](https://wordpress.org/support/users/thomdj/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 42 total)

1 [2](https://wordpress.org/support/users/thomdj/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/thomdj/replies/page/3/?output_format=md)
[→](https://wordpress.org/support/users/thomdj/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Highlight Search Terms] Create compatibility with WP Grid Builder](https://wordpress.org/support/topic/create-compatibility-with-wp-grid-builder/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/create-compatibility-with-wp-grid-builder/#post-17725430)
 * Hi there,
 * I’ve made it a separate plugin for now, so no worries about anything being overwritten.
   It only utilizes mark.js, not the added functionalities added by hlst-extend,
   so better integration is definitely possible. The plugin folder is wp-grid-builder
   and the main file is wp-grid-builder.php. I can send you a copy of the plugin
   if that helps?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Highlight Search Terms] Create compatibility with WP Grid Builder](https://wordpress.org/support/topic/create-compatibility-with-wp-grid-builder/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/create-compatibility-with-wp-grid-builder/#post-17713744)
 * That makes sense! I noticed it had Search & Filter Pro compatibility, and plans
   for FacetWP, hence the question.
 * Anyway, I’ve been tinkering with it for the last couple of days to make it work
   myself, and it does!
 *     ```wp-block-code
       document.addEventListener('DOMContentLoaded', function() {
           const container = document.querySelector('.wpgb-viewport');
   
           function getQueryParamFromURL() {
               const urlParams = new URLSearchParams(window.location.search);
               for (const [key, value] of urlParams) {
                   if (key.startsWith('_') && key.length > 1) {
                       return value;
                   }
               }
               return '';  // Returns empty if no matching param is found
           }
   
           let lastSearchTerm = '';
           let lastHeight = container.style.height;
   
           function highlightText(force = false) {
               const searchTerm = getQueryParamFromURL();
               if (!searchTerm || (searchTerm === lastSearchTerm && !force)) return;
   
               lastSearchTerm = searchTerm;
               const elementsToMark = container.querySelectorAll('.wpgb-card');
               const instance = new Mark(elementsToMark);
               instance.unmark({
                   done: function() {
                       instance.mark(searchTerm, {
                           element: 'mark',
                           className: 'highlight'
                       });
                   }
               });
           }
   
           const observer = new MutationObserver(mutations => {
               mutations.forEach(mutation => {
                   if (mutation.attributeName === 'style') {
                       let newHeight = container.style.height;
                       if (newHeight !== lastHeight) {
                           lastHeight = newHeight;
                           highlightText(true);
                       }
                   }
               });
           });
   
           observer.observe(container, {
               attributes: true,
               attributeFilter: ['style']
           });
   
           highlightText(); // Initial call to highlight any existing content
       });
       ```
   
 *     ```wp-block-code
       $searchTerm = '';
       foreach ($_GET as $key => $value) {
           if (strpos($key, '_') === 0 && strlen($key) > 1) {
               $searchTerm = sanitize_text_field($value);
                   break;
           }
       }
   
       wp_localize_script('wpgb-highlight-script', 'wpgbParams', array(
           'searchTerm' => $searchTerm
       ));
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Mollie Payments for WooCommerce] Plugin moves currency symbol to the right at checkout](https://wordpress.org/support/topic/plugin-moves-currency-symbol-to-the-right-at-checkout/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/plugin-moves-currency-symbol-to-the-right-at-checkout/#post-17550764)
 * Alright, I submitted a ticket, thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Temporary Login Without Password] Add custom post type support?](https://wordpress.org/support/topic/add-custom-post-type-support/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/add-custom-post-type-support/#post-17548081)
 * Also, the plugin auto-generates a username based on the first and last name, 
   but doesn’t remove spaces if a person has more than one first or last name. Perhaps
   it would be useful to also remove spaces automatically when generating the username.
 *     ```wp-block-code
       /**
        * Create a random username for the temporary user
        *
        * @param array $data
        *
        * @return string
        */
       public static function create_username( $data ) {
           $first_name = isset( $data['user_first_name'] ) ? $data['user_first_name'] : '';
           $last_name  = isset( $data['user_last_name'] ) ? $data['user_last_name'] : '';
           $email      = isset( $data['user_email'] ) ? $data['user_email'] : '';
   
           $name = '';
   
           if ( ! empty( $first_name ) || ! empty( $last_name ) ) {
               // Remove spaces from first and last names and concatenate them
               $name = str_replace( array( '.', '+', ' ' ), '', strtolower( trim( $first_name . $last_name ) ) );
   
               // Transliterate special characters to ASCII equivalents
               $name = iconv('UTF-8', 'ASCII//TRANSLIT', $name);
   
               // Remove any non-alphanumeric characters
               $name = preg_replace('/[^a-zA-Z0-9]/', '', $name);
           } else {
               if ( ! empty( $email ) ) {
                   $explode = explode( '@', $email );
                   // Use portion before '@' symbol as name and remove spaces
                   $name    = str_replace( array( '.', '+', ' ' ), '', $explode[0]);
               }
           }
   
           if ( username_exists( $name ) ) {
               $name = $name . substr( uniqid( '', true ), - 6 );
           }
   
           $username = sanitize_user( $name, true );
   
           /**
            * We are generating WordPress username from First Name & Last Name fields.
            * When First Name or Last Name comes with non-latin words, the generated username
            * might be non-latin, and the sanitize_user function might discard it, resulting
            * in the user not being generated.
            *
            * To avoid this, if this situation occurs, we are generating a random username
            * for this user.
            */
           if ( empty( $username ) ) {
               $username = self::random_username();
           }
   
           return sanitize_user( $username, true );
       }
       ```
   
    -  This reply was modified 2 years, 2 months ago by [ThomDJ](https://wordpress.org/support/users/thomdj/).
    -  This reply was modified 2 years, 2 months ago by [ThomDJ](https://wordpress.org/support/users/thomdj/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Temporary Login Without Password] Add custom post type support?](https://wordpress.org/support/topic/add-custom-post-type-support/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/add-custom-post-type-support/#post-17548069)
 * Changing the function of class-wp-temporary-login-without-password-common.php
   at line #1121 to the following achieves what I’m looking for:
 *     ```wp-block-code
       /**
        * Get all public post types that are not excluded from search
        * Group posts by post type and sort them by post type name
        * Display post type names in the language used in WordPress
        *
        * @param string $selected
        *
        * @since 1.6.9
        */
       public static function tlwp_dropdown_redirect_to( $selected = '' ) {
   
           // Get all public post types that are not excluded from search
           $post_types = get_post_types( array(
               'public'            => true,
               'exclude_from_search' => false,
           ), 'objects' );
   
           // Array to store all posts from public post types grouped by post type
           $items_by_type = array();
   
           // Loop through each public post type
           foreach ( $post_types as $post_type ) {
               // Get posts for the current post type
               $posts = get_posts( array(
                   'post_type'      => $post_type->name,
                   'post_status'    => 'publish',
                   'posts_per_page' => -1
               ) );
   
               // Add each post to the items_by_type array under its post type
               foreach ($posts as $post) {
                   $items_by_type[$post_type->name][] = array(
                       'ID'        => $post->ID,
                       'post_title'=> $post->post_title,
                       'post_type' => $post_type->name
                   );
               }
           }
   
           // Start building the dropdown HTML
           $output = '';
   
           // Loop through each post type
           foreach ($items_by_type as $type => $items) {
               // Sort items alphabetically by post title within each post type
               usort($items, function($a, $b) {
                   return strcmp($a['post_title'], $b['post_title']);
               });
   
               // Get translated post type name
               $post_type_label = get_post_type_object($type)->labels->name;
   
               // Start an optgroup for each post type
               $output .= "<optgroup label='" . esc_attr( $post_type_label ) . "'>";
               foreach ($items as $item) {
                   // Preselect specified item
                   $is_selected = ( $selected == $item['ID'] ) ? 'selected="selected"' : '';
   
                   // Add an <option> element for each item
                   $output .= "\n\t<option value='" . esc_attr( $item['ID'] ) . "' $is_selected>" . esc_html( $item['post_title'] ) . "</option>";
               }
               $output .= "</optgroup>";
           }
   
           // Echo the generated HTML
           echo $output;
       }
       ```
   
    -  This reply was modified 2 years, 2 months ago by [ThomDJ](https://wordpress.org/support/users/thomdj/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Mollie Payments for WooCommerce] Plugin moves currency symbol to the right at checkout](https://wordpress.org/support/topic/plugin-moves-currency-symbol-to-the-right-at-checkout/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/plugin-moves-currency-symbol-to-the-right-at-checkout/#post-17546066)
 * Can I email you? It’s not a publicly accessible site.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Fastest Cache - WordPress Cache Plugin] Cache Url with QueryString](https://wordpress.org/support/topic/cache-url-with-querystring/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/cache-url-with-querystring/#post-16885985)
 * Perfect, thank you!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Cache Warmer] Setting up a cronjob](https://wordpress.org/support/topic/setting-up-a-cronjob/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/setting-up-a-cronjob/#post-16885975)
 * Yes, when using Rank Math sitemap, it is working as intended! 🙂
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Autoptimize] Exclude all scripts from plugin (via Regex)?](https://wordpress.org/support/topic/exclude-all-scripts-from-plugin-via-regex/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/exclude-all-scripts-from-plugin-via-regex/#post-16885863)
 * Thanks, that did the trick! 😀
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Fastest Cache - WordPress Cache Plugin] Cache Url with QueryString](https://wordpress.org/support/topic/cache-url-with-querystring/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/cache-url-with-querystring/#post-16882325)
 * Awesome! So /tag/?_keyword_filter=banana and /tag/?_keyword_filter=apple would
   also be served separate cached pages?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Fastest Cache - WordPress Cache Plugin] Cache Url with QueryString](https://wordpress.org/support/topic/cache-url-with-querystring/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/cache-url-with-querystring/#post-16881085)
 * If not, would it be possible to [Rewrite the Query String to a Path](https://www.taniarascia.com/rewrite-query-string-to-path-with-htaccess/)
   and subsequently have it be cached separately? (So rewrite it to [https://YOURDOMAIN.COM/tag/example](https://YOURDOMAIN.COM/tag/?_keyword_filter=example))
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Content No Cache | Serve uncached partial content even when you add it to a page that is fully cached.] Doesn’t seem to work with Justified Image Grid shortcodes?](https://wordpress.org/support/topic/doesnt-seem-to-work-with-justified-image-grid-shortcodes/)
 *  [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/doesnt-seem-to-work-with-justified-image-grid-shortcodes/#post-16880884)
 * Hi, this is the case with WP Grid Builder as well, even when adding request=”
   remote” to the shortcode. The content does not show up.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Cache Warmer] Setting up a cronjob](https://wordpress.org/support/topic/setting-up-a-cronjob/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/setting-up-a-cronjob/#post-16880362)
 * Hi, I already changed the sitemap plugin on this website, but the one I used 
   was this one: [XML Sitemap & Google News](https://wordpress.org/plugins/xml-sitemap-feed/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Meta Generator and Version Info Remover] Please add Redux Framework as an option](https://wordpress.org/support/topic/please-add-redux-framework-as-an-option/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/please-add-redux-framework-as-an-option/#post-16880359)
 * Hello, my comment was premature, because your plugin already removes this meta
   tag, even though it’s not a separate option. Sorry!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Cache Warmer] Setting up a cronjob](https://wordpress.org/support/topic/setting-up-a-cronjob/)
 *  Thread Starter [ThomDJ](https://wordpress.org/support/users/thomdj/)
 * (@thomdj)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/setting-up-a-cronjob/#post-16847692)
 * Going back to my previous post, it seems to be something specific to this sitemap
   plugin, as it works perfectly fine using another plugin.

Viewing 15 replies - 1 through 15 (of 42 total)

1 [2](https://wordpress.org/support/users/thomdj/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/thomdj/replies/page/3/?output_format=md)
[→](https://wordpress.org/support/users/thomdj/replies/page/2/?output_format=md)