Tagged: full width stick menu
-
AuthorPosts
-
November 2, 2021 at 3:43 pm #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);
November 3, 2021 at 3:27 am #1327552Hey 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,
IsmaelNovember 3, 2021 at 9:28 am #1327595HI Ismael,
the page isn’t live yet, so you can check that there.
November 5, 2021 at 8:49 am #1327902Hi,
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,
IsmaelNovember 5, 2021 at 10:06 am #1327918Hi Ismael,
sure – there you go.
November 10, 2021 at 2:53 pm #1328517Hi,
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,
IsmaelNovember 10, 2021 at 6:01 pm #1328555Hi 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
November 12, 2021 at 4:46 am #1328717Hi,
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,
IsmaelNovember 15, 2021 at 5:13 pm #1329117Hi 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?November 16, 2021 at 5:49 am #1329157Hi,
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/EfhxsIYThe items “html styles” and “hello world” are both sticky posts.
Best regards,
IsmaelNovember 17, 2021 at 3:12 pm #1329354Hi Ismael,
as just now, “Demobeitrag 9” is not being displayed on our end.
November 18, 2021 at 4:37 am #1329410Hi,
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,
IsmaelNovember 24, 2021 at 3:07 pm #1330324Hi 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
November 26, 2021 at 7:50 am #1330548Hi,
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,
IsmaelJune 13, 2023 at 9:07 pm #1410511Hi 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.
June 16, 2023 at 6:13 am #1410888Hi 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 -
AuthorPosts
- You must be logged in to reply to this topic.