Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter Garaiburu

    (@garaiburu)

    argh! Of course. I always forget that Jetpack’s a plugin.
    Really useful info too. Thanks
    I’ll try the classic editor tile block trick.

    cheers

    John

    Thread Starter Garaiburu

    (@garaiburu)

    Hi, Sorry for the delay in getting back to you.
    In answer to your question; It’s the tiled-gallery block from WordPress 5.9 i.e. not a plug-in gallery.
    Here’s a link to screenshots of the tiled-gallery block settings, gallery page and lightbox without caption.

    wp 5.9 tiled gallery block setting

    Hope they help.

    Let me know if you need anything else.

    All the best

    John

    Thread Starter Garaiburu

    (@garaiburu)

    ah, ok I’ll put it in the index, or try to. Every time I tried before I broke something which is why I put it in content.php.
    Fingers crossed I get it right this time!

    Thread Starter Garaiburu

    (@garaiburu)

    not sure why the code split in the earlier post. I’ll try again!

    	$time_start = microtime(true);
    
    /** Set up a date interval object for 6 monts ago (you can change as required) */
    $interval = new DateInterval('P145M');
    $interval->invert = 1;
    
    /** Grab the date as it was 6 months ago */
    $date = new DateTime(date('Y-m-d'));
    $date->add($interval);
    
    /** Query the database for all posts newer than the the given date interval */
    $args = array(
        'nopaging'          => true,
        'posts_per_page'    => -1,
        'post_type'         => 'post',
        'post_status'       => 'publish',
        'order_by'          => 'date',
        'date_query'        => array(
            'after' => $date->format('Y-m-d')
        )
    );
    $month_query = new WP_Query($args);
    
    /** Check to ensure that there are articles for this month... */
    if($month_query->have_posts()) :
    
        $month_titles = array();
        $close_ul = false;
        
        
        //echo '<ul style="padding-left: 250px;" id="monthly-posts">';
        
        /** Set the attributes for displaying the title as an attribute */
        $title_attribute_args = array(
            'before'    => 'Visit article \'',
            'after'     => '\' ',
            'echo'      => false
        );      
        
        /** Loop through each post for this month... */
        while($month_query->have_posts()) : $month_query->the_post();
        
            /** Check the month/year of the current post */
            $month_title = date('F Y', strtotime(get_the_date('Y-m-d H:i:s')));
            
            /** Maybe output a human friendly date, if it's not already been output */
            if(!in_array($month_title, $month_titles)) :
            
                if($close_ul) echo '</ul>';                                                             // Check if the unordered list of posts should be closed (it shouldn't for the first '$monthe_title')
                echo '<h1  id="monthly-title">' . $month_title . '</h1>';   // Output the '$month_title'
                echo '<ul  id="monthly-posts">';                            // Open an unordered lists for the posts that are to come
                $month_titles[] = $month_title;                                                         // Add this <code>$month_title' to the array of</code>$month_titles

    so that it is not repeated
    $close_ul = true; // Indicate that the unordered list should be closed at the next oppurtunity

    endif;

    /** Output each article for this month */
    printf(
    ‘<li style=”target”> %2$s<hr style=”under”><span>%3$s</span>‘,
    get_the_ID(), /** %1$s – The ID of the post */
    get_the_title(), /** %2$s – The article title */
    get_the_time(‘jS’), /** %3$s – The time */
    get_permalink(get_the_ID()), /** %4$s – The article link */
    );

    endwhile;

    if($close_ul) echo ‘‘; // Close the last unordered list of posts (if there are any shown)

    endif;

    /** Reset the query so that WP doesn’t do funky stuff */
    wp_reset_query()`

    Thread Starter Garaiburu

    (@garaiburu)

    Hi,
    thanks for that. I think it’s working now. At least the ordering seems to be working my end. The only little problem remaining is that the list seems to wrap on itself i.e. when you get to the last blog post it reloads the whole list from the top which is annoying (although no one will ever scroll that far in all likelyhood).

    I ended up using this code which I plugged into content.php (maybe that’s the problem? should it be on the index after the loop?). Anyway here it is:

    	$time_start = microtime(true);
    
    /** Set up a date interval object for 6 monts ago (you can change as required) */
    $interval = new DateInterval('P145M');
    $interval->invert = 1;
    
    /** Grab the date as it was 6 months ago */
    $date = new DateTime(date('Y-m-d'));
    $date->add($interval);
    
    /** Query the database for all posts newer than the the given date interval */
    $args = array(
        'nopaging'          => true,
        'posts_per_page'    => -1,
        'post_type'         => 'post',
        'post_status'       => 'publish',
        'order_by'          => 'date',
        'date_query'        => array(
            'after' => $date->format('Y-m-d')
        )
    );
    $month_query = new WP_Query($args);
    
    /** Check to ensure that there are articles for this month... */
    if($month_query->have_posts()) :
    
        $month_titles = array();
        $close_ul = false;
        
        
        //echo '<ul style="padding-left: 250px;" id="monthly-posts">';
        
        /** Set the attributes for displaying the title as an attribute */
        $title_attribute_args = array(
            'before'    => 'Visit article \'',
            'after'     => '\' ',
            'echo'      => false
        );      
        
        /** Loop through each post for this month... */
        while($month_query->have_posts()) : $month_query->the_post();
        
            /** Check the month/year of the current post */
            $month_title = date('F Y', strtotime(get_the_date('Y-m-d H:i:s')));
            
            /** Maybe output a human friendly date, if it's not already been output */
            if(!in_array($month_title, $month_titles)) :
            
                if($close_ul) echo '</ul>';                                                             // Check if the unordered list of posts should be closed (it shouldn't for the first '$monthe_title')
                echo '<h1  id="monthly-title">' . $month_title . '</h1>';   // Output the '$month_title'
                echo '<ul  id="monthly-posts">';                            // Open an unordered lists for the posts that are to come
                $month_titles[] = $month_title;                                                         // Add this <code>$month_title' to the array of</code>$month_titles

    so that it is not repeated
    $close_ul = true; // Indicate that the unordered list should be closed at the next oppurtunity

    endif;

    /** Output each article for this month */
    printf(
    ‘<li style=”target”> %2$s<hr style=”under”><span>%3$s</span>‘,
    get_the_ID(), /** %1$s – The ID of the post */
    get_the_title(), /** %2$s – The article title */
    get_the_time(‘jS’), /** %3$s – The time */
    get_permalink(get_the_ID()), /** %4$s – The article link */
    );

    endwhile;

    if($close_ul) echo ‘‘; // Close the last unordered list of posts (if there are any shown)

    endif;

    /** Reset the query so that WP doesn’t do funky stuff */
    wp_reset_query()`

    thanks for your steers on this.

    cheers

    John

    Thread Starter Garaiburu

    (@garaiburu)

    Mmm. I’m obviously doing something wrong. I’ve essentially replaced the loop on my current index page (an adapted version of twentysixteens default index) and am getting nowhere (other than breaking everything). Any suggestions for how to knit this code into the index?

    cheers

    John

    Thread Starter Garaiburu

    (@garaiburu)

    Thanks! That looks perfect. I’ll give it a whirl.

    cheers

    John

    Thread Starter Garaiburu

    (@garaiburu)

    Hi Ben,

    just a quick follow up on yesterday’s messages since it might be of some interest/use to you. I tried foo gallery’s masonry style in the popup and it works. I’ve no idea what the difference is, but for whatever reason it calculates the gallery dimensions without needing a browser nudge, or any custom CSS applied to the element ( which I tried yesterday and half worked).
    If you can figure out why it would be great to incorporate it into yours, which in every other respect is crackin’.

    Anyway, just thought I’d let you know.

    cheers

    john

    Thread Starter Garaiburu

    (@garaiburu)

    Hi Ben

    thanks for the explanation. Very helpful. From what you say it seems like the options are to ditch the popups or ditch the masonry.
    I did try the set up with your modal block and while it does fire up the gallery properly, there’s more admin involved in managing them on the page rather than linking to a popup. And I assume the more of them there are (there will be loads) the slower the page will get. (But I could be wrong about that)

    Thanks for your help

    cheers

    john

    Thread Starter Garaiburu

    (@garaiburu)

    Hi Hannah

    I just put a page together on a site I have online that shows the behaviour.

    Here’s the link

    https://leadwhite.co.uk/test/

    Hope this helps

    cheers

    John

    Thread Starter Garaiburu

    (@garaiburu)

    Hi Hannah

    I would, but I’ve not put it online yet. It’s all happening locally.
    I could put a page up on a site I have online that recreates the behaviour? but that site has loads of plugins, new functions etc which might confuse things.
    I’ll give it a go tho and let you know when it’s up

    all the best

    john

    Thread Starter Garaiburu

    (@garaiburu)

    Hi Hannah

    I was looking into the issue and came across this. Does this explain what’s going on?

    https://docs.wppopupmaker.com/article/264-sliders-inside-popups

    I tried the general solution they suggest (the adding an add action to ensure the box has a size) but it doesn’y work. But maybe I misunderstood.

    cheers

    john

    Thread Starter Garaiburu

    (@garaiburu)

    Hi Hannah

    Just following up on my earlier post with details that I missed.

    I have 4 plugins loaded into a fresh install of WordPress 5.4.2. They are:

    Kadence Blocks – Gutenberg Page Builder Toolkit 1.8.5
    Kadence Blocks Pro 1.4.9
    Popup Maker 1.10.2 (by popup maker)
    Smash Balloon Instagram feed ( by smash balloon)

    Php version is 5.7.14

    The theme is a child of Twenty Twenty but the behavior is the same if I switch theme to a vanilla version of Twenty-Twenty.
    The child currently comprises about 18 CSS changes and no change/additions to functions.php)
    The CSS changes essentially just hide the header the footer and style the links. It’s barely even a child!

    Anyway hope some of this might help diagnose what’s happening. Let me know if you need more info.

    cheers

    John

    Thread Starter Garaiburu

    (@garaiburu)

    Hi Hannah

    thanks for getting back to me.

    It works fine on the back end, only struggles on the front. I wonder whether it might be to do with the fact that I’m putting it in a pop up?
    It’s as if it doesn’t know what height it is until the browser is nudged.
    All of the other galleries work fine in the pop up, but I have a weakness for masonry layouts. Always the way!

    Also once the browser’s nudged ( resized by just a couple of pixels) it works and continues to work until I refresh the page i.e. I can invoke the pop up repeatedly and the gallery displays properly until I refresh the page. Presumably because the size has been cached?

    I’ll send on screen shots when I get back in front of it. They might help the diagnosis

    cheers

    john

Viewing 14 replies - 1 through 14 (of 14 total)