Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #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?

    #1337978

    Hey 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,
    Ismael

    #1338029

    Thanks 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.

    #1338127

    Hi,

    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,
    Ismael

    #1338181

    Thanks 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!

    #1338355

    Hi,

    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,
    Ismael

    #1338649

    Thanks Ismael could you show me an example of how to best output categories in that block?

    #1338815

    Hi,

    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,
    Ismael

    #1339306

    Thanks 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?

    #1339484

    Hi,

    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,
    Ismael

    #1339751

    Thank 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!

    #1339763

    Hmm 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.

    #1340078

    Hi,

    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,
    Ismael

    #1341108
    This reply has been marked as private.
    #1341282

    Hi,

    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,
    Ismael

    #1341310

    Yes 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?

    #1341564

    Hi,

    There is a copy of the class-avia-masonry.php file config-templatebuilder/avia-shortcode-helpers/ folder. Please remove the duplicate file, then add the modifications again in the original file.

    Best regards,
    Ismael

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