How do I add a custom body class for a specific page ID?

I have added this code to my child theme’s functions.php file and use the new class but it styles the entire site, not the page I added to the code. What am I doing wrong? add_filter(‘body_class’,’custom_body_class’); function custom_body_class($classes) { if( is_page(‘38034’) ) { $classes[] = ‘new-class’; return $classes; } } Source: https://wordpress.stackexchange.com/feeds

Web Design Weekly #86

Headlines jQuery 2.0 Released jQuery 2.0 is out, but as a reminder, it does not support IE6/7/8. In return, it is smaller, faster and can be used in JavaScript environments where the code needed for old-IE compatibility often causes problems of its own. But don’t worry, the jQuery team still supports the 1.x branch, which does run on IE 6/7/8. (blog.jquery.com) Clown Car – Responsive Image Technique (github.com) Support this newsletter by becoming a member for the price of a coffee → Articles Animating with Physics To achieve realistic animations…

Display custom fields in frontside user profile

I installed the CIMY User Extra Fields plugin to add new custom fields in theuser profile. I added 1 custom field for gender to the user profile but it displays only in the admin panel user profile. How to display on the front side registered user profile page? Have any one idea.. Please send me step by step because new in WordPress. Source: https://wordpress.stackexchange.com/feeds

Web Design Weekly #85

Headlines Farewell, hgroup The elements has been removed from HTML 5.1. From my research the consensus seems to be that it will not be misssed. In this post Bruce Lawson explains what this means for us when writing mark up for taglines and subheaders into the future. (brucelawson.co.uk) Understanding JavaScript Inheritance Alex Sexton explains the concepts behind JavaScript Inheritance in a very entertaining manner. (alexsexton.com) Testing for Asynchronous Load of Inapplicable CSS StyleSheets (github.com) Support this newsletter by becoming a member for the price of a coffee → Articles Code…

How to stop form resubmission on page refresh

Hi I have a form that adds attachments to a post, however when the form posts it obviously doesn’t show the post with the new attachment echoing « your file has been uploaded ». When the user refreshes the page (to try and show their new attachment) the form posts again! Is it possible to either (1) stop the form posting again on refresh, (2) automatically refresh the page to display the post with its new attachment?? (2 is way better) <?php $post_id = $post->ID; if ( isset( $_POST[‘html-upload’] ) && !empty(…

Web Design Weekly #84

Headlines Media Queries are a Hack Ian Storm Taylor shares some very interesting thoughts about media queries. He stresses that we should start rallying behind element queries so we can write truly modular CSS. (ianstormtaylor.com) Responsive Nav – A simple JavaScript plugin (responsive-nav.com) Advanced cross-browser flexbox (dev.opera.com) Articles Can we get rid of gradient prefixes? Lea Verou shares some up to date knowledge on the current status of gradient prefixes. Her conclusion is that there is no need to use -ms- prefixed gradients. You should include -moz- for the less…

Dynamic number of fields in a meta box

I am working with a recipes blog and I use custom meta boxes. $food_box = array( ‘id’ => ‘foodbox’, ‘title’ => __(‘Ingredients details’,’splus’), ‘page’ => ‘recipes’, ‘context’ => ‘normal’, ‘priority’ => ‘high’, ‘fields’ => array(),); $arr = array ( ‘name’ => ‘-‘, ‘desc’ => ‘-‘, ‘id’ => ‘-‘,’type’ => ‘text’, ‘std’ =>  »); add_action(‘admin_menu’, ‘mytheme_add_box’); // Add meta box function mytheme_add_box() { global $meta_box; global $food_box; global $test_box; add_meta_box( $meta_box[‘id’], $meta_box[‘title’], ‘recipe_details_show_box’, $meta_box[‘page’], $meta_box[‘context’], $meta_box[‘priority’] ); add_meta_box( $food_box[‘id’], $food_box[‘title’], ‘ingredients_show_box’, $food_box[‘page’], $food_box[‘context’], $food_box[‘priority’] ); } Acoording to recipe ingredients are…

Get count of custom post type created by current user

I’m trying to get the count of published posts in a custom post type for the current user (to display on a profile page). I found this here on the forums: <?php global $wp_query; $curauth = $wp_query->get_queried_object(); $post_count = $wpdb->get_var(« SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = ‘ » . $curauth->ID . « ‘ AND post_type = ‘user_video’ AND post_status = ‘publish' »); ?> But, it’s just giving me a big fat ZERO even though there are definitely published posts of that type. What am I doing wrong and is there a better way…