Serving a custom featured image for mobile

I would do this with Advanced Custom Fields and a Sass mixin: @mixin image-2x($image, $width, $height) { @media (min–moz-device-pixel-ratio: 1.3), (-o-min-device-pixel-ratio: 2.6/2), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx) { background-image: url($image); background-size: $width $height; } } //Usage div.logo { background: url(“logo.png”) no-repeat; @include image-2x(“logo2x.png”, 100px, 25px); } Featured images or native custom fields could also … Read more

Metabox with checkbox is not working true!

That error happened because the $savedusers is not an array — in_array() requires the second parameter be a valid array, and if it’s not, that error (or warning) is thrown. And a simple fix to that is by type-casting the variable to an array like so: $savedusers = (array) get_post_meta( $post_id, ‘U_S_C_users’, true ); Or … Read more

display all registered meta boxes

All the meta boxes are kept in a multidimensional array, called $wp_meta_boxes. It will display all of the meta boxes registered for a specific screen and a specific context. Use the following code: function get_meta_boxes( $screen = null, $context=”advanced” ) { global $wp_meta_boxes; if ( empty( $screen ) ) $screen = get_current_screen(); elseif ( is_string( … Read more

metabox dosn’t save with checkbox of post_type values order by taxonomy

i don’t know how can i save this metabox please helpe me. This Is my code : <?php function book_function_meta_box(){ add_meta_box(‘book_meta_box’, ‘more Infos’, ‘book_meta_box_callback’, ‘book’, ‘normal’); } add_action(‘add_meta_box’, ‘book_add_meta_box’); function book_meta_box_callback() { wp_nonce_field(‘book_save_meta_box_data’, ‘book_nonce_name’); $terms = get_terms( ‘category’, array( ‘orderby’ => ‘id’, ‘hide_empty’ => 1 // hide categories with no posts ) ); foreach ($terms … Read more