Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Header configuration & styling »

[SOLVED] Add a Postís Category Name to Body Class


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old Feb 20, 2013, 11:28 PM
johnnybravo
 
36 posts · Apr 2011
Russia
Hi from Russia.
How to Add a Postís Category Name to Body Class?
I need it for customize menu.
I found only this example:
Code:
function add_category_name($classes = '') {
   if(is_single()) {
      $category = get_the_category();
      $classes[] = 'category-'.$category[0]->slug; 
   }
   return $classes;
}
add_filter('body_class','add_category_name');
Can this code help me? Where i have to insert this code? functions.php?
  #2  
Old Feb 21, 2013, 02:40 AM
juggledad's Avatar
juggledad
 
21,702 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
Where did the place you found the code snippet suggest you put it?
Did you try it?
__________________
If you like my help, please consider donating. I am happy to provide greater detail on this and other topics if you hire me. Please send detailed support requests to me as a private message, thank you.
Juggledad | Forum Moderator/Support
  #3  
Old Feb 21, 2013, 03:22 AM
johnnybravo
 
36 posts · Apr 2011
Russia
Here
I did not try, because I do not know where to insert this code.
  #4  
Old Feb 21, 2013, 03:41 AM
juggledad's Avatar
juggledad
 
21,702 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
That link tells you where to put the snippet.
__________________
If you like my help, please consider donating. I am happy to provide greater detail on this and other topics if you hire me. Please send detailed support requests to me as a private message, thank you.
Juggledad | Forum Moderator/Support
  #5  
Old Feb 21, 2013, 04:22 AM
johnnybravo
 
36 posts · Apr 2011
Russia
Thanks!!! It works!!! Now in body classes i can see class - "category-name" and in css i added some style for this category. Cool!!!

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Post Body Content Missing & Category Pages 404 MichaelNagel Center area post/pages 11 Aug 11, 2012 02:22 AM
How to remove body text from category view? thesis Atahualpa 3 Wordpress theme 4 Nov 21, 2009 06:31 AM
something between the body of the post and post title ireneeng New Versions, & Updating 1 Nov 9, 2009 03:30 PM
[SOLVED] Can't change post titles? = Atahualpa Post Option->Body Title Single Pages? Muncheys New Versions, & Updating 2 Nov 8, 2009 06:17 AM


All times are GMT -6. The time now is 04:08 AM.


Powered by vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.