Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #1327491

    Hey,

    on our news page, we have a masonry gallery that outputs blog posts of different categories – I have already started a thread here which seem to work (https://kriesi.at/support/topic/sticky-blogposts-when-using-a-masonry-gallery/), but sadly now the “Load more” button doesn’t show up anymore. Also, not all posts are getting displayed.

    In addition to that, if there aren’t any posts of the category “news” on the first hand, there will not be a button for “news” unless you load more posts and they happen to be within the category “news” -> Button “News” appears.

    Is there a solution to all of this?

    This is the code in the functions.php:

    add_filter("avia_masonry_entries_query", function($query, $params) {
      global $post;
      if($post->ID != 153) { 
    //only want this on a specific page
        return $query;
      }
      $include = array();
      $sticky = get_option( 'sticky_posts' );
    
      $args = array(
    //taxonomy not working, using category instead
        'category' => $params['categories'],
        'post__not_in' => $sticky,
      );
      $posts = get_posts( $args );
    
      foreach($posts as $post) {
        $include[] = $post->ID;
      }
    
      $include = array_merge($sticky, $include);
      // convert values of the $include from string to int
      function sti($n)
      {
        settype($n, 'int');
        return $n ;
      }
    
      $include = array_map("sti", $include);
    
      $query['post__in'] = $include;
      $query['orderby'] = 'post__in'; // sort items based on the post__in value
      return $query;
    }, 10, 2);
    
    
    #1327552

    Hey emilconsor,

    Thank you for the inquiry.

    Would you mind creating a test page so that we can check the issue? Please provide the site URL and the login account in the private field.

    Best regards,
    Ismael

    #1327595

    HI Ismael,

    the page isn’t live yet, so you can check that there.

    #1327902

    Hi,

    Thank you for the info.

    The Appearance > Editor panel is not accessible, so we were not able to check or test the masonry filter. Please activate the file editor or post the FTP details in the private field so that we can check the issue properly.

    Best regards,
    Ismael

    #1327918

    Hi Ismael,

    sure – there you go.

    #1328517

    Hi,

    Thank you for the update and quite sorry for the delay.

    The load more button is not displaying because we did not specify the number of posts that should be retrieved using the query, so it defaults to 6 items. We adjusted the code a bit and set the posts_per_page parameter to retrieve all posts that matches the taxonomy query.

    We adjusted this line.

    	$args = array(
    	  'posts_per_page' => -1,
    	  'post__not_in' => $sticky,
    	  'tax_query' => $query['tax_query']
    	);
    

    Best regards,
    Ismael

    #1328555

    Hi Ismael,

    thank you for your time!
    This is working now, except there are still some posts missing. There should be 8 posts, but there are only 7 showing up. Do you have an idea on why this is the case?

    Regards

    #1328717

    Hi,

    Thank you for following up.

    We are not really sure why that particular post is not displaying in the frontend, but it looks like newer posts get automatically added in the list. We created a new post to test it. There are now 8 posts in the home page. Have you tried deleting and recreating that post?

    Best regards,
    Ismael

    #1329117

    Hi Ismael,

    yes, we tried that. There is always one blog post missing, independent of which one.
    I’ve created a post and now suddenly the post not showing up anymore is a different one and the one who wasn’t showing up before is showing now.
    It seems like there is always one post missing and I can’t find the reason.
    Can this collide with the sticky-post code?
    Like maybe one post is getting removed from displaying because of the sticky post or something?

    #1329157

    Hi,

    Thank you for the update.

    We cannot reproduce the issue on our end. All posts (9 items in total) are displayed in the masonry element with or without the filter above. The load more button is working properly as well.

    Filter active: https://imgur.com/PKsY3gO
    Filter inactive: https://imgur.com/EfhxsIY

    The items “html styles” and “hello world” are both sticky posts.

    Best regards,
    Ismael

    #1329354

    Hi Ismael,

    as just now, “Demobeitrag 9” is not being displayed on our end.

    #1329410

    Hi,

    Thank you for the info.

    Temporarily, you might have to remove the filter and apply a special category (featured or sticky for example) to the sticky posts or the items that you would like to display at the very top. You can then add another masonry element above the current one and select the new category.

    Best regards,
    Ismael

    #1330324

    Hi Ismael,

    thanks for the suggestion, we will look into that.
    I can only say that the code above seems to “override” a random post. Without the code in the functions.php, all posts are getting displayed.
    Is there anything you/we can do here?

    Regards

    #1330548

    Hi,

    As shown in the screenshot above, the modification is working properly on our installation, so there might be something in your site that is conflicting with the filter. Unfortunately, we cannot figure out what that is. Adding two masonry element above each other should be a valid solution.

    Thank you for your patience.

    Best regards,
    Ismael

    #1410511

    Hi There,

    This is the only thread I could find similar to what I want to do for my client’s blog land page.

    #1. https://07t.663.myftpupload.com/capsc-blog/ – I would like to use the sticky menu below the header to function like the category sorting feature for masonry blog posts. The sticky menu would basically replace the built-in sorting feature. What is the best way to do that in the child template? I would also need to be able to add or remove categories as needed.

    #2. Is there code for “total read time” that can be displayed on the blog posts landing page that is included with the title and excerpt for each post?

    #3. For this masonry section, I selected the title and except to show but it looks like only the title is showing. Anyway to fix this?

    JUST AN FYI… I am currently using a dev site and will need to copy and paste any code changes to the live site.

    #1410888

    Hi Monique,

    1.) The modification mentioned above filters the masonry items and displays the sticky posts above the rest of the items, which differs from what you are trying to achieve. Unfortunately, moving the category sort below the header would require modifications that are beyond the scope of our support. You may consider hiring a freelance developer or reaching out to our partner, Codeable, for assistance.

    // https://kriesi.at/contact/customization

    2.) To add a “total read time” section in your posts, you can utilize any of the following plugins:

    // Reading Time WP Plugin: https://wordpress.org/plugins/reading-time-wp/
    // https://wordpress.org/plugins/search/reading+time/

    3.) If you have used the Advanced Layout Builder to create the content of your posts, you may need to manually add the excerpt for each post.

    If you have any additional questions at this time we kindly ask that you open them up in a separate thread. The longer threads get in the forum, they become more difficult to support as they tend to drift off topic and they also make it troublesome for users trying to search for solutions. Keeping threads relevant to their original inquiry ensures that we can keep better track of what has been resolved and that users can more effectively find answers to similar issues they might be experiencing.

    Thanks!

    Best regards,
    Ismael

Viewing 16 posts - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.