Insert attachment ID in custom field from media uploader
I found it: http://www.acousticwebdesign.net/web-design/creating-custom-meta-boxes-in-wordpress/
I found it: http://www.acousticwebdesign.net/web-design/creating-custom-meta-boxes-in-wordpress/
I think I know what you mean, and if that is the case it’s actually a straightforward operation. Firstly get all the object_ids from the term_relationship table. $results = $wpdb->get_results(“SELECT `object_id` FROM $wpdb->term_relationships WHERE `term_taxonomy_id` = 18”); And then run through each of those values and update_post_meta to 18. foreach ( $results as $result ) … Read more
While you can create this all from scratch in your theme, I have really been liking the plugin Advanced Custom Fields as an alternative. It has a few flaws, but the major ones (such as slowing down your site) seem to have been fixed, and it’s super-easy to use. Best of luck to you!
The function that returns the contents of that ajax request will not be in admin-ajax.php. That is the core WordPress file that handles ajax requests, but it is not used for specifying the data returned by ajax functions in themes / plugins. In the theme (somewhere), will be a line that looks like this: add_action(‘wp_ajax_myajax-submit’, … Read more
You should make a plugin, that way it is portable to any theme. Generally speaking people need to stop filling up functions.php or theme files with code that is better suited for scalability and flexibility, aka a plugin.
Here’s the metabox code what I’m using which is working fine for me: // Add meta boxes with TinyMCE via wp_editor() function // Define the custom box add_action( ‘add_meta_boxes’, ‘product_details_add’ ); // Do something with the data entered add_action( ‘save_post’, ‘product_details_save’ ); // Adds a box to the main column on the Product post_type edit … Read more
Try instead $user_contactmethods[‘work’] = __(‘I work for…’); and <?php echo get_user_meta($current_user->ID,’work’,true);?> where the array index is ‘work’ instead of ‘I work for…’, i.e. lowercase and without any spaces.
After analyzing nextgen core files I have found solution to my problem. I hope it will be useful for somebody. global $nggdb; $get_gall_id = get_post_meta($post_id, ‘galerijos_id’, true); $gall_ids = $nggdb->get_ids_from_gallery($get_gall_id); $images = $nggdb->get_gallery($get_gall_id); foreach ( $gall_ids as $gall_id ) { echo $images[$gall_id]->imageURL .'<br>’; }
The obvious advantage of user meta is that you can use the WordPress API to record and retrieve these extra columns, without writing extra PHP classes or SQL queries. The wp_usermeta table is pretty well indexed, in fact, it uses one row per field (rather than one column if you use a custom table), and … Read more
The WP_Query has a feature called meta_query. Using it allows you to either query by value or numeric value: $car = new WP_Query( array( ‘post_type’ => array( ‘cars’ ), ‘meta_key’ => ‘car_number’, ‘orderby’ => ‘meta_value_num’, ‘posts_per_page’ => 1, ‘order’ => ‘DESC’, ‘cache_results’ => true, ) ); $carNr = get_post_meta( $car->ID, ‘car_number’, true ); // Inspect … Read more