• R
    rsepierre

    The Default textformat CSS is applied two recurring times in the code.
    It's not breaking or anything, but just "more code for nothing".

    Here's what I found :

    I noticed in the inspector that the same CSS rule was applied two times to the same selector and that they were very close (line 109 and line 114)

    0_1606391965533_e7afaf8f-149c-4a5e-ac5d-97ea12e5dfa3-image.png

    I searched in laygridders files for .lg-textformat-parent > *, ._Default{ and added /* test n° */ to each occurence.

    0_1606391726994_ef4be69c-b4df-433a-982f-b752a7d34b63-image.png

    Result in the rendered HTML :

    0_1606391893555_5f30de7d-a006-4933-88a2-fccb60d24232-image.png

    After code inspection, it seems like test 1 and test 5 are identical rules that can be both printed depending on those conditions :

    • "test 1" will be printed every time, no matter what.
    • "test 5" will be printed if LayGridderFormatsManager::$hasTabletSettings is false

    I'm pretty sure we can delete the second occurrence ( where I commented /* test 5 */ ) without any consequence except cleaner code.

    laygridder > formatsmanager > formatsmanager.php -- line 486
    0_1606392721907_37c8e127-f06b-4823-9c5b-d48ffe28e5c2-image.png

    I also found this issue on most of the other website featured on laygridder.com.
    The ones I didn't find the issue probably had LayGridderFormatsManager::$hasTabletSettings enabled.

    posted in Bug Reports read more
  • R
    rsepierre

    Hi there

    @f-albert-work I'm just seeing your answer now.

    I'm still getting the "made with LayGridder" for each grid i'm displaying on the same page.
    Currently running LayGridder version 1.1.7 (wp says "This plugin is up to date." ).

    Here is the very simple loop i'm using.
    It queries the_laygrid() for each post and I get "made with LayGridder" for each post.

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
            <a href="<?php the_permalink(); ?>">
                <?php the_laygrid( get_field('project_cover')->ID ); ?>
                <button class="open"><?php the_title(); ?></button>
            </a>
        </article>				
    <?php endwhile; endif; ?>
    

    0_1582479122027_8f717009-610b-4659-8939-bd6fb7a02cf7-image.png

    Because there is no workaround, I just removed the <no script> bit from the plugin code as a temporary measure.
    My changes will get erased with the next update.

    posted in Feature Requests read more
  • R
    rsepierre

    @rsepierre

    		// get all posts of post type "post"
    		$args = array(
    			'posts_per_page' => -1,
    			'orderby' => 'menu_order',
    			'post_type' => 'post'
    		);
    		$all_posts_query = new WP_Query( $args );
    
    		// get all pages
    		$args = array(
    			'posts_per_page' => -1,
    			'orderby' => 'menu_order',
    			'post_type' => 'page'
    		);
    		$pages_query = new WP_Query( $args );
    
    		// get all posts of custom post types
    		$posts_of_custom_post_types = array();
    		foreach ($custom_post_types as $post_type) {
    
    			$args = array(
    				'posts_per_page' => -1,
    				'orderby' => 'menu_order',
    				'post_type' => $post_type->name
    			);
    			$custom_posts_query = new WP_Query( $args );
    			if($custom_posts_query->have_posts()){
    				$posts_of_custom_post_types[$post_type->name] = $custom_posts_query->posts;
    			}
    		}
    

    For now I patched every 'post_per_page' => -1 to be 'post_per_page' => 99
    (if there is more I probably don't want to target a specific post)

    But maybe the best option would be to be able to search when there is more than a defined number of posts

    posted in Bug Reports read more
  • R
    rsepierre

    Hi !

    LayGridderLocation::get_select_view() is pretty much querying every post on the wp and then inserting it in the DOM as an option for the LayGridder > Options > Location form".

    <option value="1">Non classé</option>
    
    a few options laters
    
    <option value="40149">Comment ça marche ?</option>
    

    With 45k posts the page was just failing to display without error bellow 1024Mo allowed to php memory.

    So I might be testing this on the wrong type of website for layGridder but even with a few hundred that might be problematic.

    posted in Bug Reports read more
  • R
    rsepierre

    Hi guys !

    I just wanted to talk about the <no script>Made with Laygridder</noscript>

    I'm all for sharing and giving credits. The only thing is that in my particular situation, I wanted to use layGridder as a cover layout building plugin. Which means that I can call 30 layouts in the same page if I want.

    (exemple : https://pierrerose.studio/projects/ )

    And while it's amazing in the back-end to build my layouts in seconds and pretty cool (with a few tweaks) in the front-end. At first on Google my page was showing as below :

    Pierre Rose Studio
    Work. Artwork. Made with layGridder. Made with layGridder. Made with layGridder. Made with layGridder. Made with layGridder. Made with layGridder. Made with layGridder. Made with layGridder ...

    While I'm still building the website and will definitely need to work on my SEO at some point, my guess is that : this is not the team's expected behaviour.

    And given the fact that it is not instroduced as a wordpress filter/action, and that there is no other implemented way to prevent it from being added 56 times (like include_once 'credits.php'), there is nothing I can do on my side to mitigate the issue (besides editing the plugin files directly or stop using laygridder).

    How important is this feature for layGridder('s team) ? Does it really bring SEO / visibility benefits for the plugin ?
    To be honest I'd actually prefer to add visible credits for the user to see and click than something for google search only (especially in it's current state).

    In my opinion, as a plugin the best fit for that <no script> would be to be printed only once in the page footer on every page that has a gridder or as a desactivable option.

    posted in Feature Requests read more
  • R
    rsepierre

    Custom img filter :

    //img Markup with LQ source, data-src and auto-size
    function get_respimg( $attid ) {
    	
        $full_src = wp_get_attachment_url( $attid );
        $alt = get_post_meta($attid, '_wp_attachment_image_alt', true);
    
        //ignore if gif||svg
        if (substr($full_src, -4) == '.gif' || substr($full_src, -4) == '.svg' ) {
            return '<img src="'.$full_src.'" alt="'.$alt.'">';
        }
        $lowQuality = wp_get_attachment_image_src($attid, 'thumbnail')[0];
        var_dump( $lowQuality );
        echo '<br>';
        $srcset = wp_get_attachment_image_srcset($attid);
        return '<img class="lazyload" data-sizes="auto" src="' . $lowQuality . '" data-srcset="' . $srcset . '" alt="' . $alt . '">';
    }
    	
    
    //Lazysize layGridder
    function lazyload_images_filter($markup, $element){
        return '<div class="lg-placeholder" style="padding-bottom:' . ($element->h/$element->w*100) . '%;">' . get_respimg($element->attid) . '</div>';
    }
    add_filter( 'lg_frontend_img', 'lazyload_images_filter', 10, 2 );
    ?>
    

    Load Lazysize for this to work

    function load_lazysize() {
        wp_enqueue_script( 'lazysizes-js', "https://cdnjs.cloudflare.com/ajax/libs/lazysizes/2.0.6/lazysizes.min.js");
    }
    add_action( 'wp_enqueue_scripts', 'load_lazysize' );
    

    What it does :

    • Loads the thumbnail img as src first (me personnaly I load another image size 25px wide)
    • Enables you to style images depending on loading state (.lazyload, .lazyloading and .lazyloaded) with the effect you desire : blur, opacity, translation
    • Then loads the perfect image size with srcset and data-sizes="auto".
    • If you want non-srcset compatible browser to show non-lowquality img, you can add data-src="$theImageSizePreferToLazyloadInstead"

    posted in General Discussion read more
  • R
    rsepierre

    @rsepierre
    also here is my config for image_sizes in function.php

    update_option( 'thumbnail_size_w', 28 ); 	// 28 (Preload)
    update_option( 'thumbnail_size_h', 0 );
    update_option( 'thumbnail_crop', 0 );
    add_image_size( '_160', 160, 0 );		// 160
    add_image_size( '_265', 265, 0 ); 		// 265
    update_option( 'medium_size_w', 512 ); 		// 512
    update_option( 'medium_size_h', 0 );
    update_option( 'medium_large_size_h', 0 );	// 768 (default width)
    add_image_size( '_1024', 1024, 0 );		// 1024
    add_image_size( '_1280', 1280, 0 );		// 1280 (HD)
    add_image_size( '_1540', 1540, 0 );		// 1540
    add_image_size( '_1920', 1920, 0 );		// 1920 (FULL HD)
    add_image_size( '_2560', 2560, 0 );		// 2560 (WQHD)
    add_image_size( '_3200', 3200, 0 );		// 3200
    add_image_size( '_3840', 3840, 0 );		// 3840 (4k)
    update_option( 'large_size_w', 5120 );		// 5120 (5k)
    update_option( 'large_size_h', 0 );
    

    posted in General Discussion read more