Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • to display thumbnails and their respective categories in a WordPress menu I created a code for this.

    // Add Thumbnail Support to Categories
    function wpse_category_thumbnail( $menu_item, $category ) {
    if ( isset( $category->term_id ) ) {
    $thumbnail_id = get_term_meta( $category->term_id, ‘thumbnail_id’, true );
    if ( $thumbnail_id ) {
    $image = wp_get_attachment_image( $thumbnail_id, ‘thumbnail’ );
    $menu_item = ‘term_id ) ) . ‘”>’ . $image . ” . $category->name . ‘‘;
    }
    }
    return $menu_item;
    }
    add_filter( ‘walker_nav_menu_start_el’, ‘wpse_category_thumbnail’, 10, 2 );

    This code is 100% working and I’m still using it on Glitch Text Generator. Please add the above-mentioned code to your theme’s functions.php file.

    Please note that depending on your theme’s styling, you may need to modify the CSS to ensure the thumbnails are displayed properly within your menu.

    • This reply was modified 1 year, 9 months ago by layladecorly.

    Thank you for sharing your experience and solving the conflict between the Cookie Notice plugin and WP Rocket’s ‘Remove Unused CSS’ function. It’s helpful to know that adding the exclusion URL in WP Rocket can resolve the issue. Your post will undoubtedly assist others who may encounter the same problem. We appreciate your contribution to the community!

    The same error I was facing on https://textgoo.com and here’s the code which would help you

    add_filter(‘rocket_cache_reject_uri’, ‘custom_disable_rocket_cache_migration’, 10, 1);
    function custom_disable_rocket_cache_migration($reject) {
    if (defined(‘WP_CLI’) && WP_CLI && isset($_SERVER[‘REQUEST_URI’]) && strpos($_SERVER[‘REQUEST_URI’], ‘/wp-admin/admin-ajax.php’) !== false) {
    $reject = true;
    }
    return $reject;
    }

    • This reply was modified 1 year, 9 months ago by layladecorly.
Viewing 2 replies - 1 through 2 (of 2 total)