• I want to show the hours in the info window popup if the category is NOT “Coming Soon”. I’ve tried the following code in my functions.php file, but it does not work. Any help?

    
       if ( $wpsl_store_category->name !== 'Coming Soon' ) {
            $info_window_template .= "\t\t" . '<% if ( hours ) { %>' . "\r\n";
            $info_window_template .= "\t\t" . '<div class="wpsl-store-hours"><strong>' . esc_html( $wpsl->i18n->get_translation( 'hours_label', __( 'Hours', 'wpsl' ) ) ) . '</strong>' . "\r\n";
            $info_window_template .= "\t\t" . '<%= hours %>' . "\r\n";
            $info_window_template .= "\t\t" . '</div>' . "\r\n";
            $info_window_template .= "\t\t" . '<% } %>' . "\r\n";    
        }
    
Viewing 1 replies (of 1 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    Not sure if this works, but try to use the wpsl_store_meta filter to add the ID of the category the location is assigned to.

    
    add_filter( 'wpsl_store_meta', 'custom_store_meta', 10, 2 );
    
    function custom_store_meta( $store_meta, $store_id ) {
        
        $store_meta['category_id'] = 'the category id value';
        
        return $store_meta;
    }
    

    Then in the template code check the value of <%= category_id %> whether or not to show the hours.

    Do flush the transient cache on the settings page ( tools section ) after making the changes.

Viewing 1 replies (of 1 total)
  • The topic ‘Show hours in more info popup if not certain category’ is closed to new replies.