meta-boxes

Wordpress meta_query compare not in issue

回眸只為那壹抹淺笑 提交于 2020-01-05 08:29:18
问题 I have a issue with wordpress meta query. I make a checkbox in meta box, When user check the check box the post is become featured. Now I call all posts except featured, but I don't get it. Here is my code: $wa_story_args = array( 'post_type' => 'stories', 'posts_per_page' => 999, 'orderby' => 'DESC', 'meta_query' => array( array( 'meta_key' => 'wa_featured_story', 'meta_value' => 'featured', 'compare' => 'NOT IN' ) ) ); 回答1: Just replace "meta_value" by "value" and "meta_key" by "key": $wa

jquery-ui sortable on divs with TinyMCE editors causes text to disappear

蹲街弑〆低调 提交于 2019-12-23 09:27:55
问题 following the instructions at: http://www.farinspace.com/multiple-wordpress-wysiwyg-visual-editors/ i've got some nice WYSIWYG editors in my metaboxes my markup looks like: <div class="sortable"> <div class="sortme"> <?php $mb->the_field('extra_content2'); ?> <div class="customEditor"><textarea name="<?php $mb->the_name(); ?>"><?php echo wp_richedit_pre($mb->get_the_value()); ?></textarea></div> </div> <div class="sortme" <?php $mb->the_field('extra_content3'); ?> <div class="customEditor">

How to make custom metabox fields duplicatable?

房东的猫 提交于 2019-12-18 03:43:50
问题 I am now currently coding a plugin for the WordPress admin. It's about custom meta boxes. I would like to create a slideshow plugin, just for learning a lot of coding. I have created one metabox, that contains an image upload and a text input field. (see picture bellow) So on, I can save the fields, so I can upload an image and set an capton to it inside the text field. When I save the post/page inside WordPress it will save the values for me in my database. That's fine! Now I would like to

How to remove custom meta box on click of a button?

江枫思渺然 提交于 2019-12-13 02:56:20
问题 I'm trying to remove a custom metabox that I've created for my plugin using PHP code. It should be removed from all the posts on click of a button. Here is my code: <?php if(isset($_REQUEST['submit_btn'])) { function remove_custom_metabox() { remove_meta_box( 'my-meta-box-id' , 'post' , 'normal' ); } add_action( 'add_meta_boxes', 'remove_custom_metabox'); } ?> Why is it not working? And is there any way to do this for multi-post custom meta-box as well? Thanks! EDIT 1: Just to get more clear

Wordpress meta boxes - WP tuts tutorial

扶醉桌前 提交于 2019-12-12 03:10:09
问题 I did these tree tutorials to create custom metaboxes. http://wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-1-intro-and-basic-fields/ http://wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-2-advanced-fields/ http://wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-3-extra-fields/ but i don't know how to call values from individual fields. I used this php script $meta = get_post_meta($post->ID, $field['custom_text'], true); echo $meta; but id doesn't work. Does

WordPress Ken Theme Error in Sidebar Editor - “Fatal error: Uncaught Error: Function name must be a string”

一个人想着一个人 提交于 2019-12-11 21:33:10
问题 Hello fellow developers and problem-solvers, I have come across this error in the WordPress dashboard in all of the existing Pages/Posts. Through my experience, I have learned PHP but I am not very experienced when it comes to core php file errors within WordPress itself. Based off similar posts, this could be a PHP version issue with PHP7, yet I'm not entirely sure. Also the theme itself may need to be updated, but I feel there should be a bug fix for this before I would consider updating

Custom Post Type ID Issue - When Querying Other Post Types

主宰稳场 提交于 2019-12-11 18:19:29
问题 I have quite a complex problem to solve which has baffled me for the last day or so. Basically, I have two custom post types 'Sessions' and 'Recipes'. These are showing fine in the backend of WordPress. Attached to the session are several meta boxes, 'Introduction Video', 'Session video', 'Goals', 'Fitness Level' and 'Featured Recipes'. The 'Featured Recipes' meta box is special, as in it queries the WordPress database to get all posts within the 'recipe' custom post type and then use these

How to display Multiple Post Thumbnails plugin custom post thumbnail image in custom template

北城以北 提交于 2019-12-11 15:01:31
问题 I have used wordpress Multiple Post Thumbnails plugin to add custom post meta box image field. if (class_exists('MultiPostThumbnails')) { new MultiPostThumbnails( array( 'label' => 'Homepage Full-Width', 'id' => 'homepage-full-width', 'post_type' => 'post' ) ); } I want to display this new featured image with full size in my site Home page big banner default featured image (http://nimb.ws/YelErQ). Right now theme above post featured image display using following code in theme front-page.php

Updating product post meta data in admin meta box field

若如初见. 提交于 2019-12-11 02:24:10
问题 I am trying to update WooCommerce product meta data using update_post_meta() function, but it does''t work. Here is my code: function woo_add_deal_general_fields_save( $post_id ){ $post_id = (int)$post_id; // tried to convert into integer $woocommerce_textarea = $_POST['_deal_textarea']; if( !empty( $woocommerce_textarea ) ) if ( get_post_meta($post_id, '_deal_textarea', FALSE ) ) { $test= update_post_meta($post_id, '_deal_textarea', $woocommerce_textarea ); } else { add_post_meta($post_id, '

WordPress: How to show a metabox on any admin page?

Deadly 提交于 2019-12-07 08:13:46
问题 I already know how to register metaboxes for Posts, Page, and Custom Post Types, but I would like to register a metabox to be shown on my custom admin page, which is not a post. My plugin has an "Options Page" in the WordPress Admin – I would like to show metaboxes on this very page. Is this possible? If yes, how can this be acheived? I saw in the add_meta_box documentation that one of the possible values for the $post_type parameter is dashboard , however this is not documented anywhere. I