Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #797662

    Hi Guys Can you please assist me?

    I am creating an enfold site that uses the blog posts on a couple of pages, which i used by dragging into a page: Avia Layout Builder > Content Elements > Blog Posts > Drag into Page
    I have used multiple categories for the blog post and I have styled the single blog posts using the categories however I cant style the blog post grid layout with these categories. I would like for these elements to be styled from the categories so that the grid layout adds the style from the selected categories inserted into the blog post.

    I found this Page which i think maybe dated as i couldn’t find the code in the postslider.php page it said to replace, but it was 2013 and maybe dated?
    https://kriesi.at/support/topic/add-category-as-a-css-class-to-blog-posts-content-element/

    Any help on this will be greatly appreciated, hope this finds you well
    Cheers Dave.

    #797701

    Hey Dave,

    The tag is now article instead of div. Aside from that, it’s essentially the same. :)

    Please look for this instead in line 378:

    $output .= "<article class='slide-entry flex_column {$style} {$post_class} {$grid} {$extraClass} {$thumb_class}' $markup>";

    And replace it with this:

    $taxonomies = get_object_taxonomies(get_post_type($the_id));
    $taxs = array();
    $excluded_taxonomies = apply_filters('avf_exclude_taxonomies', array('post_tag', 'post_format'), get_post_type($the_id), $the_id);
    if (!empty($taxonomies)) {
    	foreach($taxonomies as $taxonomy) {
    		if (!in_array($taxonomy, $excluded_taxonomies)) {
    			$taxs[] = wp_get_post_terms($the_id, $taxonomy);
    		}
    	}
    }
    foreach($taxs as $tax) {
    	foreach($tax as $term) {
    		$post_class .= ' '.$term -> slug. ' ';
    	}
    }
    $output .= "<article class='slide-entry flex_column {$style} {$post_class} {$grid} {$extraClass} {$thumb_class}' $markup>";
    

    I hope that helps!

    Best regards,
    Sarah

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