Add Useragent to the body class?

something like this maybe: function my_class_names($classes) { $useragent = $_SERVER[‘HTTP_USER_AGENT’]; if(strchr($useragent,’Safari’)) $classes[] = ‘Safari’; // etc.. return $classes; } add_filter(‘body_class’,’my_class_names’); Edit – as per Chip’s suggestion, here’s the function using the WordPress useragents checks: function my_class_names($classes) { global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone; if($is_lynx) $classes[] = ‘lynx’; elseif($is_gecko) $classes[] = ‘gecko’; elseif($is_winIE) … Read more

Add extra field to users

your function never defines a value for that field so when you check if its equal to 1 you never get true. try this: add_action( ‘show_user_profile’, ‘module_user_profile_fields’ ); add_action( ‘edit_user_profile’, ‘module_user_profile_fields’ ); function module_user_profile_fields( $user ) { ?> <h3>Module Options</h3> <table class=”form-table”> <tr> <th><label for=”module_activation”>Module Activation</label></th> <td> <input id=”module_activation” name=”module_activation” type=”checkbox” value=”1″ <?php if ( … Read more

Using WP_Query – how to display something IF there are no results

So, let’s say $query is your WP_Query object. I.e. $query = new WP_Query($some_query_args ); Then you can set up ‘the loop’, by $query->get_posts(); Then to check if there are actually any returned results: if ( $query->have_posts() ) : //Use a While loop to show the results else: //No results, let’s show a message instead. //This … Read more

How to add some custom HTML to the edit posts page

As found here: http://codex.wordpress.org/Function_Reference/add_meta_box /** * Calls the class on the post edit screen */ function call_someClass() { return new someClass(); } if ( is_admin() ) add_action( ‘load-post.php’, ‘call_someClass’ ); /** * The Class */ class someClass { const LANG = ‘some_textdomain’; public function __construct() { add_action( ‘add_meta_boxes’, array( &$this, ‘add_some_meta_box’ ) ); } /** … Read more

Is it possible to disable a function of a parent theme?

Only under some circumstances. If the parent theme’s functions are wrapped in function_exists conditionals then you should be able to replace them. For example: // Parent if (!function_exists(‘p_wpse_95799’)) { function p_wpse_95799() { // } } If the child theme defines a function named p_wpse_95799 then the parent function will not be used. If this is … Read more

How to remove hardcoded characters from playlists?

Inside the shortcode function for playlists, there is this line: do_action( ‘wp_playlist_scripts’, $atts[‘type’], $atts[‘style’] ); Hooked into that is wp_playlist_scripts() which hooks the templates into the footer: add_action( ‘wp_footer’, ‘wp_underscore_playlist_templates’, 0 ); add_action( ‘admin_footer’, ‘wp_underscore_playlist_templates’, 0 ); So if you want to replace the templates, you can hook into wp_playlist_scripts after those hooks have been … Read more

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş