Forum Replies Created

Viewing 15 replies - 1 through 15 (of 24 total)
  • Thread Starter tuomvii

    (@tuomvii)

    I also have the User Role Editor uploaded to the site if I’m able to edit the permissions there?

    Thread Starter tuomvii

    (@tuomvii)

    This was resolved. For some reason there was a CSS call like this:

    #masthead {
    position: absolute !important;
    }

    This obviously removed it from the structure flow. Don’t know if it was the plugin or theme or what but glad this is ok now.

    Thread Starter tuomvii

    (@tuomvii)

    @nmedia thank you very much for your response! This works beautifully now. Will be using your plugin in the future too. Nice support <3

    Thread Starter tuomvii

    (@tuomvii)

    I managed to get the inputs of the custom fields to show with this one after creating the new Site Reviews folder with the review.php file inside to my theme folder:

    add_filter('site-reviews/review/build/after', function ($renderedFields, $review) {
        foreach ($review->custom as $key => $value) {
            if ($key == 'service_rating') {
                $value = glsr_star_rating($value); // render the stars from the rating value
            }
            if (is_array($value)) {
                $list = array_reduce($value, function ($result, $item) {
                    return $result.'<li>'.$item.'</li>';
                });
                $value = '<ul>'.$list.'</ul>';
            }
            $renderedFields[$key] = '<div class="glsr-custom-'.$key.'">'.$value.'</div>';
        }
        return $renderedFields;
    }, 10, 2);

    Still, am I able to get the custom field inputs to appear in the reviews on the admin dashboard?

    Thread Starter tuomvii

    (@tuomvii)

    @nmedia, before the snippet it shows the options like this:

    1 unit [+24,90 €]
    3 units [+44,90 €]
    5 units [+99,90 €]

    When I use this snippet in the functions.php file:

    add_filter('ppom_option_label', 'ppom_change_label', 11, 4);
    function ppom_change_label($label, $option, $meta, $price){
       
        $label = "{$option_label}({$price})";
        return $label;
    }

    Notice that I removed the plus sign on purpose.

    But after it show’s like this:

    (24,90 €)
    (44,90 €)
    (99,90 €)

    So the labels before the prices are removed and not showed.

    Thread Starter tuomvii

    (@tuomvii)

    Thank you very much for this @nmedia! One simple question, does removing the plus sign affect the plugin somehow? Is it mandatory?

    And for some reason when using that snippet, it doesn’t show the option labels “1 unit”, “3 units” etc.

    • This reply was modified 5 years, 2 months ago by tuomvii.
    Thread Starter tuomvii

    (@tuomvii)

    Hi everyone! This problem hasn’t been sorted out. I contacted the Simple YouTube Embed plugin’s creator but it isn’t the plugin’s fault. So it has to be WP. Any help?

    Thread Starter tuomvii

    (@tuomvii)

    Actually I use Chrome on my mobile and tried using Firefox and the video showed on Firefox! So I think this is a browser issue. @spirosbo any ideas?

    Thread Starter tuomvii

    (@tuomvii)

    Thank you Oleg!

    Yeah, as soon as I tested the default WooCommerce shortcode and changed the selector to the default container the filter works. Too bad I have to do my stylings again, but that’s not a big of a problem!

    Thank you very much! I’ll be using your plugin in the future too <3

    EDIT: For some reason after the filtering has been done the product images are dissapeared. Any idea why this is happening?

    • This reply was modified 5 years, 7 months ago by tuomvii.
    Thread Starter tuomvii

    (@tuomvii)

    Hi! I tested your plugin and it seems to be working halfway through. I made a filter and tested it on the products, it activates and starts loading the container with AJAX but it doesn’t filter them. All of the products stay there even though I picked one category. Is this a selector problem?

    EDIT: On the admin side the plugin gives the “No products found” error that’s included in the plugin.

    • This reply was modified 5 years, 7 months ago by tuomvii.
    • This reply was modified 5 years, 7 months ago by tuomvii.
    Thread Starter tuomvii

    (@tuomvii)

    Could someting in this case this? This is what I use to bring the products.

    
    application/x-httpd-php woo_products.php ( C++ source, ASCII text, with very long lines )
    <?php
    namespace SmWidgets\Widgets;
    
    use Elementor\Widget_Base;
    use Elementor\Controls_Manager;
    use Elementor\Base_Control;
    
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    
    /**
     * Elementor Hello World
     *
     * Elementor widget for hello world.
     *
     * @since 1.0.0
     */
    
    class WooProducts extends Widget_Base {
    
    	/**
    	 * Retrieve the widget name.
    	 *
    	 * @since 1.0.0
    	 *
    	 * @access public
    	 *
    	 * @return string Widget name.
    	 */
    	public function get_name() {
    		return 'sm-woo-products';
    	}
    
    	/**
    	 * Retrieve the widget title.
    	 *
    	 * @since 1.0.0
    	 *
    	 * @access public
    	 *
    	 * @return string Widget title.
    	 */
    	public function get_title() {
    		return __( 'WooCommerce Products', 'manufacturer' );
    	}
    
    	/**
    	 * Retrieve the widget icon.
    	 *
    	 * @since 1.0.0
    	 *
    	 * @access public
    	 *
    	 * @return string Widget icon.
    	 */
    	public function get_icon() {
    		return 'eicon-posts-grid';
    	}
    
    	/**
    	 * Retrieve the list of categories the widget belongs to.
    	 *
    	 * Used to determine where to display the widget in the editor.
    	 *
    	 * Note that currently Elementor supports only one category.
    	 * When multiple categories passed, Elementor uses the first one.
    	 *
    	 * @since 1.0.0
    	 *
    	 * @access public
    	 *
    	 * @return array Widget categories.
    	 */
    	public function get_categories() {
    		return [ 'theme-elements' ];
    	}
    
    	/**
    	 * Retrieve the list of scripts the widget depended on.
    	 *
    	 * Used to set scripts dependencies required to run the widget.
    	 *
    	 * @since 1.0.0
    	 *
    	 * @access public
    	 *
    	 * @return array Widget scripts dependencies.
    	 */
    	public function get_script_depends() {
    		return [ 'manufacturer' ];
    	}
    
    	/**
    	 * Whether the reload preview is required or not.
    	 *
    	 * Used to determine whether the reload preview is required.
    	 *
    	 * @since 1.0.0
    	 * @access public
    	 *
    	 * @return bool Whether the reload preview is required.
    	 */
    	public function is_reload_preview_required() {
    		return true;
    	}
    
    	/**
    	 * Register the widget controls.
    	 *
    	 * Adds different input fields to allow the user to change and customize the widget settings.
    	 *
    	 * @since 1.0.0
    	 *
    	 * @access protected
    	 */
    
    	/**
    	 * Get post types.
    	 */
    	private function man_posts_type() {
    		$options = array();
    		$exclude = array( 'attachment', 'elementor_library' ); // excluded post types
    
    		$args = array(
    			'public' => true,
    		);
    
    		foreach ( get_post_types( $args, 'objects' ) as $post_type ) {
    			// Check if post type name exists.
    			if ( ! isset( $post_type->name ) ) {
    				continue;
    			}
    
    			// Check if post type label exists.
    			if ( ! isset( $post_type->label ) ) {
    				continue;
    			}
    
    			// Check if post type is excluded.
    			if ( in_array( $post_type->name, $exclude ) === true ) {
    				continue;
    			}
    
    			$options[ $post_type->name ] = $post_type->label;
    		}
    
    		return $options;
    	}
    
    	/**
    	 * Get post type categories.
    	 */
    	private function man_post_type_categories( $post_type ) {
    		$options = array();
    
    		$taxonomy = 'product_cat';
    
    		if ( ! empty( $taxonomy ) ) {
    			// Get categories for post type.
    			$terms = get_terms(
    				array(
    					'taxonomy'   => $taxonomy,
    					'hide_empty' => false,
    				)
    			);
    			if ( ! empty( $terms ) ) {
    				foreach ( $terms as $term ) {
    					if ( isset( $term ) ) {
    						if ( isset( $term->slug ) && isset( $term->name ) ) {
    							$options[ $term->slug ] = $term->name;
    						}
    					}
    				}
    			}
    		}
    
    		return $options;
    	}
    	/**
    	 * Register the widget controls.
    	 *
    	 * Adds different input fields to allow the user to change and customize the widget settings.
    	 *
    	 * @since 1.0.0
    	 *
    	 * @access protected
    	 */
    	protected function _register_controls() {
    		$this->start_controls_section(
    			'man_offices_content',
    			[
    				'label' => __( 'Content', 'manufacturer' ),
    			]
    		);
    
    		// Post categories.
    		$this->add_control(
    			'grid_post_categories',
    			[
    				'type'      => \Elementor\Controls_Manager::SELECT,
    				'label'     => __( 'Category', 'manufacturer' ),
    				'options'   => $this->man_post_type_categories( 'product' ),
    			]
    		);
    
    		
    
    		$this->add_control(
    			'items',
    			[
    				'label' => __( 'Columns', 'manufacturer' ),
    				'type' => Controls_Manager::TEXT,
    				'default' => '2',
    				'render_type' => 'template',
    				'condition' => [
    					'vertical' => '',
    				],
    			]
    		);
    
    		$this->add_control(
    			'items_number',
    			[
    				'label' => __( 'Items', 'manufacturer' ),
    				'type' => Controls_Manager::TEXT,
    				'default' => '6',
    				'render_type' => 'template',
    				
    			]
    		);
    
    		$this->add_control(
    			'slider',
    			[
    				'label' => __( 'Slider', 'manufacturer' ),
    				'type' => Controls_Manager::SWITCHER,
    			]
    		);
    
    		$this->add_control(
    			'vertical',
    			[
    				'label' => __( 'Vertical Products', 'manufacturer' ),
    				'type' => Controls_Manager::SWITCHER,
    			]
    		);
    
    		
    		
    
    		$this->end_controls_section();
    
    		
    
    	}
    
    	/**
    	 * Render the widget output on the frontend.
    	 *
    	 * Written in PHP and used to generate the final HTML.
    	 *
    	 * @since 1.0.0
    	 *
    	 * @access protected
    	 */
    	protected function render() {
    		$settings = $this->get_settings();
    
    		// Arguments for query.
    		$args = array();
    		// Display only published posts.
    		$args['post_status'] = 'publish';
    		if ($settings['items_number'] == 0){
    			$args['posts_per_page'] = 999999;
    		}else{
    			$args['posts_per_page'] = $settings['items_number'];
    		}
    		$args['tax_query'] = array(                     
    	    'relation' => 'AND',                      
          array(
            'taxonomy' => 'product_cat',               
            'field' => 'slug',                    
            'terms' => array( $settings['grid_post_categories'] ),    
            'include_children' => true,           
            'operator' => 'IN'                  
          ),
        );
    
    		// Ignore sticky posts.
    		$args['ignore_sticky_posts'] = 1;
    		$args['post_type'] = 'product';
    		// Display posts in category.
    
    		$paged = get_query_var( 'paged' );
    		$args['paged'] = $paged;
    		// Query.
    		$query = new \WP_Query( $args );
    		$items = 4; 
    		if ($settings['items'] == 2) {
    			$items = 6;
    		}elseif($settings['items'] == 3){
    			$items = 4;
    		}elseif($settings['items'] == 4){
    			$items = 3;
    		}else{
    			$items = 4;
    		}
    		if ($settings['vertical'] == 'yes'){
    			$items = 5;
    		}
    		?>
    
    		<?php if ($settings['slider'] == 'yes'){ ?>
    			<div class="products woo_products owl-carousel <?php if ($settings['vertical'] == 'yes'){ echo 'man_vertical_products';}else{ echo 'man_news';} ?>" data-items="<?php echo esc_attr($settings['items']); ?>">
    		<?php }else{ ?>
    			<div class="man_news_list woo_products products row">
    		<?php } ?>
    
    		<?php 
    
    		// Query results.
    		if ( $query->have_posts() ) {
    			while ( $query->have_posts() ) {
    				$query->the_post();
    				global $product; 
    		?>
    			
    			<?php if ($settings['slider'] == 'yes'){ ?>
    
    			<div class="product products-default">
    
    				<div class="man_product_photo">
    					<a href="<?php the_permalink(); ?>" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">
    						
    						<?php if ($settings['vertical'] == 'yes'){ ?>
    						<img width="185" height="325" src="<?php echo get_the_post_thumbnail_url( get_post(), 'manufacturer_vertical_thumb'); ?>" class="attachment-woocommerce_thumbnail size-woocommerce_thumbnail wp-post-image" alt="" />
    						<?php }else{ ?>
    						<img width="360" height="280" src="<?php echo get_the_post_thumbnail_url( get_post(), 'woocommerce_thumbnail'); ?>" class="attachment-woocommerce_thumbnail size-woocommerce_thumbnail wp-post-image" alt="" />
    						<?php } ?>
    
    					</a>
    				</div>
    
    				<div class="man_product_cont man_product_cont_no_price">
    				
    				<?php if ($settings['vertical'] == 'yes'){ ?>
    					<h5><?php the_title(); ?></h5>
    				<?php }else{ ?>
    				<a href="<?php the_permalink(); ?>">
    					<h3><?php the_title(); ?></h3>        
    				</a>
    				<?php } ?>
    				
    				<?php if ($settings['vertical'] !== 'yes'){ ?>
    				<a href="<?php the_permalink(); ?>" class="button product_type_simple btn"  rel="nofollow"><?php echo esc_attr__( 'Read More', 'manufacturer' ); ?></a>	
    				<?php } ?>
    
    				</div>
    			</div>
    
    			<?php }else{ ?>
    
    				<div class="product products-default col-md-<?php echo esc_attr($items); ?> col-sm-4">
    
    					<div class="man_product_photo">
    						<a href="<?php the_permalink(); ?>" class="woocommerce-LoopProduct-link woocommerce-loop-product__link"><img width="360" height="280" src="<?php echo get_the_post_thumbnail_url( get_post(), 'woocommerce_thumbnail'); ?>" class="attachment-woocommerce_thumbnail size-woocommerce_thumbnail wp-post-image" alt="" /></a>
    						<?php do_action( 'woocommerce_after_shop_loop_item' ); ?>	
    					</div>
    
    					<div class="man_product_cont man_product_cont_no_price">
    
    					<a href="<?php the_permalink(); ?>">
    						<?php do_action( 'woocommerce_after_shop_loop_item_title' ); ?>
    
    						<h3><?php the_title(); ?></h3>        
    					</a>
    
    					
    
    					</div>
    				</div>
    				
    			<?php } ?>
    			
    				
    
    		<?php 
    			} // End while().
    			
    
    		}?>
    		</div>
    		<!-- Carousel End -->
    		
    		
    
    		<?php 
    
    		// Restore original data.
    		wp_reset_postdata();
    
    	}
    
    }
    
    
    Thread Starter tuomvii

    (@tuomvii)

    @3sonsdevelopment Than you for your answer! I have already taken that “Uncropped” option but it did nothing for me unfortunately. I have also unchecked the checbox from the Settings => Media section but it didn’t do anything for me also.

    Thread Starter tuomvii

    (@tuomvii)

    Ill ask from the WooCommerce section thanks!

    Thread Starter tuomvii

    (@tuomvii)

    @wclovers Could you make the view counter feature compatible with JS/AJAX so that it is compatible with WP Rocket and other stuff that could work via AJAX and not PHP?

    Thread Starter tuomvii

    (@tuomvii)

    So the view counter just won’t work if caching is on or do you have a solution for that? ??

    • This reply was modified 5 years, 9 months ago by tuomvii.
Viewing 15 replies - 1 through 15 (of 24 total)