- Sold between 250 000 and 1 000 000 dollars
- Won a Competition
- Author was Featured
- Item was Featured
- Exclusive Author
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Europe
- Bought between 10 and 49 items
Is there a way to check what shortcodes user used in the page/post? And based on that add a class to the body, or somewhere else in the templates file?
Thanks!
- Sold between 250 000 and 1 000 000 dollars
- Community Moderator
- Author was Featured
- Item was Featured
- Bought between 50 and 99 items
- Referred between 1000 and 1999 users
- Has been a member for 3-4 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
Off the top of my head, you’ll probably want to look into using the body_class filter. You can read a good post on it here: http://www.nathanrice.net/blog/wordpress-2-8-and-the-body_class-function/
This is the basic idea:
add_filter('body_class', 'my_body_classes');
function my_body_classes($classes, $class) {
// add 'my-class' to the $classes array
$classes[] = 'my-class';
// return the $classes array
return $classes;
}
I’m not sure if you can call add_filter directly in your shortcode or if you’ll need to be more creative.
Hope that helps 
- Sold between 250 000 and 1 000 000 dollars
- Won a Competition
- Author was Featured
- Item was Featured
- Exclusive Author
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Europe
- Bought between 10 and 49 items
Off the top of my head, you’ll probably want to look into using thebody_classfilter. You can read a good post on it here: http://www.nathanrice.net/blog/wordpress-2-8-and-the-body_class-function/This is the basic idea:
add_filter('body_class', 'my_body_classes'); function my_body_classes($classes, $class) { // add 'my-class' to the $classes array $classes[] = 'my-class'; // return the $classes array return $classes; }I’m not sure if you can call add_filter directly in your shortcode or if you’ll need to be more creative.
Hope that helps![]()
Thanks! This is actually a good idea! To go from the opposite direction. Thanks!
