Tagged: Blog, blog category, category pages, php code
-
AuthorPosts
-
April 9, 2018 at 4:07 pm #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"> →</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!
April 10, 2018 at 12:34 am #939470Please help! I’m certain this is a quick fix, however I’m not a PHP programmer, and I do have a client waiting…
April 10, 2018 at 8:39 am #939703Hi,
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,
IsmaelApril 10, 2018 at 5:54 pm #939954Hello 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!
April 12, 2018 at 4:23 am #940746 -
AuthorPosts
- You must be logged in to reply to this topic.