
-
AuthorPosts
-
January 30, 2022 at 4:17 am #1337882
My blog layout is set to ALE, I’m using a masonry display. I want it to display the Post Category but I cant find the setting that enables this. What do I need to edit to control the Meta elements in the masonry display?
January 31, 2022 at 6:04 am #1337978Hey jond33,
Thank you for the inquiry.
The category info is not included in the masonry template by default but you can still add them using “avf_masonry_entry_content” filter. Please try this code in the functions.php file.
add_filter("avf_masonry_entry_content", function($content, $entry, $config) { $categories = get_the_category($entry["ID"]); $separator = ' '; $output = ''; if ( ! empty( $categories ) ) { $output .= "<ul>"; foreach( $categories as $category ) { $output .= '<li>' . esc_html( $category->name ) . '</li>'; } $output .= "</ul>"; $content = $content . $output; } return $content; }, 10, 3);
Please note that the filter above will only on the default post type or post types that supports categories.
Best regards,
IsmaelJanuary 31, 2022 at 11:41 am #1338029Thanks Ismael, that worked, can you tell me if it is possible to re-position the category, at the moment it appears after the excerpt and above the date.
February 1, 2022 at 5:23 am #1338127Hi,
Thank you for the update.
Where do you want to place the categories? You can reverse the position of the $content and the $output in this line to place the categories before the excerpt.
$content = $content . $output;
Best regards,
IsmaelFebruary 1, 2022 at 10:44 am #1338181Thanks again Ismael, that also worked!
Is it possible to make a more radical change such as moving that category up into av-masonry-image-container so as to overlay the featured image?
I appreciate the support!February 2, 2022 at 5:17 am #1338355Hi,
That should be possible but you will have to add the modification directly inside config-templatebuilder/avia-shortcode-helpers/class-avia-masonry.php file because there are no filters available for this area. You can insert the categories output within this block, located on line 574.
$bg = '<div class="av-masonry-outerimage-container">'; $bg .= $img_before; $bg .= "<div class='av-masonry-image-container' {$img_style} {$outer_title} {$outer_alt}>"; $bg .= $img_html; $bg .= '</div>'; $bg .= '</div>';
Best regards,
IsmaelFebruary 3, 2022 at 10:15 am #1338649Thanks Ismael could you show me an example of how to best output categories in that block?
February 4, 2022 at 6:33 am #1338815Hi,
Thank you for following up.
You can use the same code above and combine it with the filter, but with a few changes. Please try to replace block 574 with this code.
$categories = get_the_category($entry["ID"]); $separator = ' '; $cats = ''; if ( ! empty( $categories ) ) { $cats .= "<ul>"; foreach( $categories as $category ) { $cats .= '<li>' . esc_html( $category->name ) . '</li>'; } $cats .= "</ul>"; } $bg = '<div class="av-masonry-outerimage-container">'; $bg .= $cats; $bg .= $img_before; $bg .= "<div class='av-masonry-image-container' {$img_style} {$outer_title} {$outer_alt}>"; $bg .= $img_html; $bg .= '</div>'; $bg .= '</div>';
Best regards,
IsmaelFebruary 7, 2022 at 11:40 am #1339306Thanks Ismael
I can not seem to get that code to make any difference to the layout of the blog, is there something I’m missing?
February 8, 2022 at 4:44 am #1339484Hi,
The categories are there but they are underneath the image container. Try to use this css code to move it on top of the background image.
.av-masonry-outerimage-container ul { position: absolute; z-index: 999; color: white; }
Best regards,
IsmaelFebruary 9, 2022 at 10:07 am #1339751Thank you for your support Ismael that looks great. Just one details, the categories still appear below the titles, can you let me know how I hide those?
Many Thanks!
February 9, 2022 at 10:56 am #1339763Hmm I seem to have lost it again, I made some edits to the css and now I cant get the categories to display again, I’ve tried clearing cache and different browsers, have CSS and Javascript set to not merge. Any help appreciated.
February 11, 2022 at 8:07 am #1340078Hi,
Just one details, the categories still appear below the titles,
Did you remove the avf_masonry_entry_content filter from the functions.php file? You have to remove the code because it inserts the categories below the title.
Hmm I seem to have lost it again, I made some edits to the css and
We are not seeing the categories in the image container anymore. Did you revert the changes in the class-avia-masonry.php file?
Best regards,
IsmaelFebruary 17, 2022 at 12:26 pm #1341108This reply has been marked as private.February 18, 2022 at 6:14 am #1341282Hi,
Thank you for the info.
The filter is already gone from the functions.php file, which is good. Did you check if the modification still exists in the config-templatebuilder/avia-shortcode-helpers/class-avia-masonry.php? This is the previous modification that we suggested.
// https://kriesi.at/support/topic/masonry-blog-meta-elements/#post-1338815
After doing the modification, make sure to add this css.
.av-masonry-outerimage-container ul { position: absolute; z-index: 999; color: white; }
Best regards,
IsmaelFebruary 18, 2022 at 10:28 am #1341310Yes that is all in place, like I said it worked at first, then I added to the css and it failed, I removed my edits but it continued to fail, seems like some kind of cache issue?
February 21, 2022 at 4:19 am #1341564 -
AuthorPosts
- You must be logged in to reply to this topic.