Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #939287

    Hello
    I’ve included the below code to my enfold child theme-functions.php file to make my blogs category pages not show the full article but show the excerpt that then links to the full article.

    add_filter('avf_blog_style','avia_change_archive_blog_layout', 10, 2); 
    function avia_change_archive_blog_layout($layout, $context){
    if($context == 'archive') $layout = 'single-big';
    return $layout;
    }
    
    add_filter( 'post-format-standard', 'avia_category_content_filter', 15, 1);
    function avia_category_content_filter($current_post)
    {
    if(!is_single())
    {
    	$current_post['content'] =  get_the_excerpt();
    	$current_post['content'] .= '<div class="read-more-link"><a href="'.get_permalink().'" class="more-link">'.__('Read more','avia_framework').'<span class="more-link-arrow">  &rarr;</span></a></div>';
    }
    return $current_post;
    }

    However, I need this snippet of code to EXCLUDE one category. I have a category named “C. Notes” that I still need to show the full article instead of the excerpt that then links to the full article.

    The category is named C. Notes, has a slug named c-notes, and has an ID of 1147

    Please help!

    #939470

    Please help! I’m certain this is a quick fix, however I’m not a PHP programmer, and I do have a client waiting…

    #939703

    Hi,

    Please edit the following line.

    if(!is_single())
    

    Add the is_tax or is_category function.

    if(!is_single() || is_tax( 'category', 'slug' );
    

    Change “slug” to the actual slug or name of the “C.Notes” category.

    Best regards,
    Ismael

    #939954

    Hello Ismael,

    Thanks for following up!

    Unfortunately this solution doesn’t seem to be working…

    First when I added your code provided it broke the site, but then I went into the theme-functions.php file and changed it to…

    if(!is_single() || is_tax( 'category', 'slug' ))

    It brought the site back up but still didn’t work, so I then changed it to…

    if(!is_single() || is_tax( 'category', 'slug' ));

    And still didn’t work.

    Thoughts?

    I can provide website credentials if needed.

    Thanks!

    #940746

    Hi,

    A closing parenthesis is missing. Sorry about that. Did you change the slug name?

    if(!is_single() || is_tax( 'category', 'C.Notes SLUG NAME' ));
    

    Adjust the “C.Notes SLUG NAME” to the actual slug or name of the category.

    Best regards,
    Ismael

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