Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #170469

    Hi Dude,

    You helped me out a couple of weeks ago, but when I updated my Enfold theme I found out the new postslider.php is a bit different than the old one. I wanted to reply to my old thread, but it has been closed…

    Unfortunately this code you supplied doesn’t work anymore:

    $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 .= ' '.'category-'.$term->slug.' ';
    }
    }
    
    $output .= "<div class='slide-entry flex_column {$style} {$post_class} {$grid} {$extraClass} {$thumb_class}'>";

    I’ve tried adding the code to the new postslider.php, (which uses an article instead of a div) but the categories are not added to the $post_class as they did before. I think the loop has to be changed?

    Hope you can help me again,

    Regards,

    Bas

    #171503

    Good morning!

    Any thoughts yet on this case? I would love to use the updated theme version because of the new svg icon font options…

    regards, Bas

    #172815

    Hello!

    This code (without the last part) works:

    $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 .= ' '.'category-'.$term->slug.' ';
    }
    }

    Tested in my local installation.

    Regards,
    Josue

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Adding a category as CSS class to “Blog Posts” content element Avia Layout bldr’ is closed to new replies.