• Resolved lucinda91

    (@lucinda91)


    Hello everyone,

    My current WP configuration

    MySQL Version: 5.5.62-0ubuntu0.14.04.1 – (Ubuntu)
    PHP Version: 7.0.33
    WordPress version: 5.2.2-en_US
    Theme used: Greenfarm
    Extensions In Place: Advanced Custom Fields, Akismet Anti-Spam, All in One SEO Pack, Contact Form 7, Easy Testimonials Pro, Envato Market, Fruitful Shortcodes, GDPR Cookie Consent, Gravity Forms, GreenFarm Shortcodes, No CAPTCHA reCAPTCHA for WooCommerce, Really Simple CAPTCHA, MailPoet 2, Ultimate Shortcodes, Slider Revolution, Smart Logo Showcase Lite, Wpshopmart Pro Tabs, Woocommerce, WP Responsive Menu, WPBakery Page Editor
    Name of the host: Plesk
    Website address:

    On this page I would like my link to be on all black square space. Currently the link is on the leaf icon, and I would like this to be like on the homepage. If I put the same code as on the homepage it does not work.

    Here is my code in the page, the main lines that pose me problem are from 19 to 23

    <?php 
    $taxonomies = array( 'taxonomy' => 'car_marque');
    $args = array(); 
    $terms = get_terms($taxonomies, $args);
    if (sizeof($terms)>0)
    {
    foreach ( $terms as $term ) {
    if($term->parent == 0){
    ?>
    <div class="smls-grid-image-wrap  smls-overlay-title-center smls-external-link-wrapper">
    <div class="smls-grid-pad-container">
    <img />logo/<?php echo $term->slug; ?>.png">
    <div class="smls-overlay-all-wrap">
    <div class="smls-overlay-title">
    <?php echo $term->name ?>
    </div>
    <a>"><span><i class="fa fa-leaf" aria-hidden="true"></i></span></a>
    </div>
    <div class="smls-overlay-wrap">	  <a class="smls-overlay-wrap" href="<?php
    if ( isset( $smls_option[ 'logo' ][ $logo_key ][ 'logo_external_link' ] ) ) {
    echo esc_url( $smls_option[ 'logo' ][ $logo_key ][ 'logo_external_url' ] );
    }
    ?>" target="_blank"></a>	 </div>      
    </div>
    </div>
    <?php
    }
    }
    }
    ?>

    Do you have a solution for the link to be on all the square space of the vehicle brands?

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, easiest is probably using jQuery. Add the following code at the end of your child themes ‘functions.php’ file (but before a closing ?>, if any):

    function my_footer_script() { ?>
    <script type="text/javascript">
            
            jQuery(document).ready(function($) {
                
                $('.smls-overlay-all-wrap').click(function() {
                    var thisHref = $(this).find('a').attr('href');
                    location.href = thisHref;
                });
    
            });
        
    </script>
    <?php }
    add_action( 'wp_print_footer_scripts', 'my_footer_script' );

    then all you need is some css to set a pointer on hover on the overlay wrapper, e.g.

    .smls-overlay-all-wrap:hover {
      cursor: pointer;
    }

    Loading of the jQuery can be conditioned so that it doesn’t load on all pages, but it should be a start.

    Thread Starter lucinda91

    (@lucinda91)

    Hi,
    Thank you very much i am too happy it works! yesss !!

    Glad to have helped, please mark the topic resolved so the queue stays clean. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plusieurs liens en php avec div sur tout un espace pour chaque logo affiché’ is closed to new replies.