当前位置: 首页>>代码示例>>PHP>>正文


PHP get_default_post_to_edit函数代码示例

本文整理汇总了PHP中get_default_post_to_edit函数的典型用法代码示例。如果您正苦于以下问题:PHP get_default_post_to_edit函数的具体用法?PHP get_default_post_to_edit怎么用?PHP get_default_post_to_edit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_default_post_to_edit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Construct function.
  */
 function __construct($parent_post, $child_post_type, $data)
 {
     WPCF_Loader::loadModel('relationship');
     $this->parent = $parent_post;
     $this->parent_post_type = $parent_post->post_type;
     $this->child_post_type = $child_post_type;
     $this->data = $data;
     // Clean data
     if (empty($this->data['fields_setting'])) {
         $this->data['fields_setting'] = 'all_cf';
     }
     $this->cf = new WPCF_Field();
     $this->cf->context = 'relationship';
     $this->children = WPCF_Relationship_Model::getChildrenByPostType($this->parent, $this->child_post_type, $this->data, $_GET);
     // If no children - use dummy post
     if (empty($this->children)) {
         $_dummy_post = get_default_post_to_edit($this->child_post_type, false);
         $this->children = array($_dummy_post);
         $this->_dummy_post = true;
     }
     $this->child_post_type_object = get_post_type_object($this->child_post_type);
     // Collect params from request
     foreach ($this->__params as $__param) {
         if (isset($_GET[$__param])) {
             $this->__urlParams[$__param] = $_GET[$__param];
         }
     }
     $post_types = get_option('wpcf-custom-types', array());
     if (array_key_exists($child_post_type, $post_types) && array_key_exists('supports', $post_types[$child_post_type])) {
         foreach ($post_types[$child_post_type]['supports'] as $key => $value) {
             $this->child_supports[$key] = (bool) $value;
         }
     }
     unset($post_types);
 }
开发者ID:MiquelAdell,项目名称:miqueladell,代码行数:38,代码来源:form-child.php

示例2: save

 function save()
 {
     $post = get_default_post_to_edit('sp_template', true);
     $post_ID = $post->ID;
     global $current_user;
     $content = '';
     switch ($_POST['starter']) {
         case 'blank':
             $content = '';
             break;
         default:
             $content = 'Default HTML';
             break;
     }
     /*            
     $my_post['ID'] = $_POST['post_ID'];
     $my_post['post_content'] = $_POST['content'];
     $my_post['post_title'] = $_POST['post_title'];
     */
     $post->post_title = $_POST['post_title'];
     $post->post_status = 'sp-custom';
     $post->post_content = $content;
     // Update the post into the database
     wp_update_post($post);
     //SendPress_Email::set_default_style( $my_post['ID'] );
     //clear the cached file.
     SendPress_Admin::redirect('Emails_Tempedit', array('templateID' => $post->ID));
     //$this->save_redirect( $_POST  );
 }
开发者ID:richardsweeney,项目名称:sendpress,代码行数:29,代码来源:class-sendpress-view-emails-tempcreate.php

示例3: init

 public function init($args = array())
 {
     if (is_object($args)) {
         $args = (array) $args;
     }
     $this->attachment_id = array();
     $this->tags = array();
     $this->medias = array();
     $this->metas = array();
     $this->fields = array();
     $this->media_count = 0;
     if (is_numeric($args)) {
         $post = get_post(intval($args));
         if ($post && isset($post->ID) && !is_wp_error($post)) {
             $this->post_id = $post->ID;
             $this->post = $post;
             return true;
         } else {
             return false;
         }
     } else {
         $this->post = get_default_post_to_edit();
         $this->post->post_category = null;
         if (is_array($args) && count($args) > 0) {
             return $this->set($args);
         } else {
             return true;
         }
     }
 }
开发者ID:umbezt,项目名称:Soka-Education-Student-Research-Project,代码行数:30,代码来源:class-wp_post_helper.php

示例4: import_media

 public function import_media()
 {
     $post = get_default_post_to_edit('attachment');
     $post->post_category = array();
     $done = array();
     foreach ($this->_get_media() as $block => $media) {
         foreach ($media as $m) {
             if (isset($done[$m])) {
                 $this->_media_pool[$block][] = $done[$m];
                 continue;
             }
             $upload = circleflip_importer_fetch_local_file($m);
             if (is_wp_error($upload)) {
                 continue;
             }
             if ($info = wp_check_filetype($upload['file'])) {
                 $post->post_mime_type = $info['type'];
             } else {
                 continue;
             }
             $post->guid = $upload['url'];
             $post_id = wp_insert_attachment($post, $upload['file']);
             //				wp_update_attachment_metadata( $post_id, wp_generate_attachment_metadata( $post_id, $upload['file'] ) );
             $this->_media_pool[$block][] = $post_id;
             $done[$m] = $post_id;
         }
     }
 }
开发者ID:purgesoftwares,项目名称:purges,代码行数:28,代码来源:class-circleflip-import-meta.php

示例5: __construct

 /**
  * Construct function.
  */
 function __construct($parent_post, $child_post_type, $data)
 {
     WPCF_Loader::loadModel('relationship');
     $this->parent = $parent_post;
     $this->parent_post_type = $parent_post->post_type;
     $this->child_post_type = $child_post_type;
     $this->data = $data;
     // Clean data
     if (empty($this->data['fields_setting'])) {
         $this->data['fields_setting'] = 'all_cf';
     }
     $this->cf = new WPCF_Field();
     $this->cf->context = 'relationship';
     $this->children = WPCF_Relationship_Model::getChildrenByPostType($this->parent, $this->child_post_type, $this->data, $_GET);
     // If no children - use dummy post
     if (empty($this->children)) {
         $_dummy_post = get_default_post_to_edit($this->child_post_type, false);
         $this->children = array($_dummy_post);
         $this->_dummy_post = true;
     }
     $this->child_post_type_object = get_post_type_object($this->child_post_type);
     // Collect params from request
     foreach ($this->__params as $__param) {
         if (isset($_GET[$__param])) {
             $this->__urlParams[$__param] = $_GET[$__param];
         }
     }
 }
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:31,代码来源:form-child.php

示例6: frontier_clone_post

function frontier_clone_post($fpost_sc_parms = array())
{
    //extract($fpost_sc_parms);
    //echo "CLONE POST<br>";
    $frontier_permalink = get_permalink();
    $concat = get_option("permalink_structure") ? "?" : "&";
    if (isset($_POST['task'])) {
        $post_task = $_POST['task'];
    } else {
        if (isset($_GET['task'])) {
            $post_task = $_GET['task'];
        } else {
            $post_task = "notaskset";
        }
    }
    $post_action = isset($_POST['action']) ? $_POST['action'] : "Unknown";
    if ($post_task == "clone" && $_REQUEST['postid']) {
        $old_post = get_post($_REQUEST['postid']);
        $old_post_id = $old_post->ID;
        //double check current user can add a post with this post type
        if (frontier_can_add($old_post->post_type)) {
            require_once ABSPATH . '/wp-admin/includes/post.php';
            global $current_user;
            //Get permalink from old post
            $old_permalink = get_permalink($old_post_id);
            // lets clone it
            $thispost = get_default_post_to_edit($fpost_sc_parms['frontier_add_post_type'], true);
            $new_post_id = $thispost->ID;
            $tmp_post = array('ID' => $new_post_id, 'post_type' => $old_post->post_type, 'post_title' => __("CLONED from", "frontier-post") . ': <a href="' . $old_permalink . '">' . $old_post->post_title . '</a>', 'post_content' => __("CLONED from", "frontier-post") . ': <a href="' . $old_permalink . '">' . $old_post->post_title . '</a><br>' . $old_post->post_content, 'post_status' => "draft", 'post_author' => $current_user->ID);
            //****************************************************************************************************
            // Apply filter before update of post
            // filter:			frontier_post_clone
            // $tmp_post 		Array that holds the updated fields
            // $old_post  		The post being cloed (Object)
            //****************************************************************************************************
            $tmp_post = apply_filters('frontier_post_clone', $tmp_post, $old_post);
            // save post
            wp_update_post($tmp_post);
            //Get the updated post
            $new_post = get_post($new_post_id);
            //get all current post terms ad set them to the new post draft
            $taxonomies = get_object_taxonomies($old_post->post_type);
            // returns array of taxonomy names for post type, ex array("category", "post_tag");
            foreach ($taxonomies as $taxonomy) {
                $post_terms = wp_get_object_terms($old_post_id, $taxonomy, array('fields' => 'slugs'));
                wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);
            }
            // Set featured image:
            $post_thumbnail_id = get_post_thumbnail_id($old_post_id);
            if (intval($post_thumbnail_id) > 0) {
                set_post_thumbnail($new_post_id, $post_thumbnail_id);
            }
            // Add/Update message
            frontier_post_set_msg(__("Post Cloned and ready edit", "frontier-post") . ": " . $new_post->post_title);
            frontier_post_set_msg(__("Post status set to Draft", "frontier-post"));
            frontier_user_post_list($fpost_sc_parms);
        }
    }
}
开发者ID:prajwalstha123,项目名称:article-editor,代码行数:59,代码来源:frontier-clone-post.php

示例7: ajax_new

 function ajax_new()
 {
     check_ajax_referer('fee-new', 'nonce');
     require_once ABSPATH . '/wp-admin/includes/post.php';
     $post = get_default_post_to_edit(isset($_POST['post_type']) ? $_POST['post_type'] : 'post', true);
     wp_set_post_categories($post->ID, array(get_option('default_category')));
     wp_send_json_success($this->edit_link($post->ID));
 }
开发者ID:foxpcteam,项目名称:wp-front-end-editor,代码行数:8,代码来源:class-fee.php

示例8: audiotheme_ajax_get_default_track

/**
 * Create a default track for use in the tracklist repeater.
 *
 * @since 1.0.0
 */
function audiotheme_ajax_get_default_track()
{
    $is_valid_nonce = !empty($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'get-default-track_' . $_POST['record']);
    if (empty($_POST['record']) || !$is_valid_nonce) {
        wp_send_json_error();
    }
    $data['track'] = get_default_post_to_edit('audiotheme_track', true);
    $data['nonce'] = wp_create_nonce('get-default-track_' . $_POST['record']);
    wp_send_json($data);
}
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:15,代码来源:ajax.php

示例9: press_it

/**
 * Press It form handler.
 *
 * @package WordPress
 * @subpackage Press_This
 * @since 2.6.0
 *
 * @return int Post ID
 */
function press_it() {

	$post = get_default_post_to_edit();
	$post = get_object_vars($post);
	$post_ID = $post['ID'] = (int) $_POST['post_id'];

	if ( !current_user_can('edit_post', $post_ID) )
		wp_die(__('You are not allowed to edit this post.'));

	$post['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : '';
	$post['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : '';
	$post['post_title'] = isset($_POST['title']) ? $_POST['title'] : '';
	$content = isset($_POST['content']) ? $_POST['content'] : '';

	$upload = false;
	if ( !empty($_POST['photo_src']) && current_user_can('upload_files') ) {
		foreach( (array) $_POST['photo_src'] as $key => $image) {
			// see if files exist in content - we don't want to upload non-used selected files.
			if ( strpos($_POST['content'], htmlspecialchars($image)) !== false ) {
				$desc = isset($_POST['photo_description'][$key]) ? $_POST['photo_description'][$key] : '';
				$upload = media_sideload_image($image, $post_ID, $desc);

				// Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes
				if ( !is_wp_error($upload) )
					$content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote(htmlspecialchars($image), '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content);
			}
		}
	}
	// set the post_content and status
	$post['post_content'] = $content;
	if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) )
		$post['post_status'] = 'publish';
	elseif ( isset( $_POST['review'] ) )
		$post['post_status'] = 'pending';
	else
		$post['post_status'] = 'draft';

	// error handling for media_sideload
	if ( is_wp_error($upload) ) {
		wp_delete_post($post_ID);
		wp_die($upload);
	} else {
		// Post formats
		if ( isset( $_POST['post_format'] ) ) {
			if ( current_theme_supports( 'post-formats', $_POST['post_format'] ) )
				set_post_format( $post_ID, $_POST['post_format'] );
			elseif ( '0' == $_POST['post_format'] )
				set_post_format( $post_ID, false );
		}

		$post_ID = wp_update_post($post);
	}

	return $post_ID;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:64,代码来源:press-this.php

示例10: mdjm_create_post

/**
 * create a new post so that the ID can be used
 * Generally used for the Payments page for creating an Invoice ID
 *
 * @param:	str		$type			Required: The type of post to create
 *			
 * @return	The post ID
 */
function mdjm_create_post()
{
    $transaction = get_default_post_to_edit($_POST['mdjm_post_type'], true);
    if (empty($transaction)) {
        return $result['type'] = 'error';
    }
    $response['type'] = 'success';
    $response['id'] = $transaction->ID;
    echo json_encode($response);
    die;
}
开发者ID:mdjm,项目名称:mobile-dj-manager,代码行数:19,代码来源:mdjm-dynamic.php

示例11: fee_inject_dummy_post

/**
 * @param string $post_type The type of the post (Default: 'post')
 * @param bool $replace_first Wether to replace the first post in the loop or not (Default: true)
 */
function fee_inject_dummy_post($post_type = 'post', $replace_first = true)
{
    global $wp_query;
    require_once ABSPATH . '/wp-admin/includes/post.php';
    $post = get_default_post_to_edit($post_type, true);
    if ($replace_first) {
        $wp_query->posts[0] = $post;
    } else {
        array_unshift($wp_query->posts, $post);
    }
}
开发者ID:nizamuddin,项目名称:wp-front-end-editor,代码行数:15,代码来源:template-tags.php

示例12: __construct

 /**
  * Construct function.
  */
 function __construct($parent_post, $child_post_type, $data)
 {
     WPCF_Loader::loadModel('relationship');
     $this->parent = $parent_post;
     $this->parent_post_type = $parent_post->post_type;
     $this->child_post_type = $child_post_type;
     $this->data = $data;
     // Clean data
     if (empty($this->data['fields_setting'])) {
         $this->data['fields_setting'] = 'all_cf';
     }
     $this->cf = new WPCF_Field();
     $this->cf->context = 'relationship';
     $this->children = WPCF_Relationship_Model::getChildrenByPostType($this->parent, $this->child_post_type, $this->data, $_GET);
     // If no children - use dummy post
     if (empty($this->children)) {
         $_dummy_post = get_default_post_to_edit($this->child_post_type, false);
         $this->children = array($_dummy_post);
         $this->_dummy_post = true;
     }
     $this->child_post_type_object = get_post_type_object($this->child_post_type);
     if (!isset($this->child_post_type_object->slug) && isset($this->child_post_type_object->name)) {
         $this->child_post_type_object->slug = $this->child_post_type_object->name;
     }
     // Collect params from request
     foreach ($this->__params as $__param) {
         if (isset($_GET[$__param])) {
             $this->__urlParams[$__param] = $_GET[$__param];
         }
     }
     /**
      * build-in types
      */
     if (in_array($child_post_type, array('page', 'post', 'attachment', 'revision', 'nav_menu_item'))) {
         foreach (array_keys($this->child_supports) as $key) {
             $this->child_supports[$key] = post_type_supports($child_post_type, $key);
         }
         return;
     }
     /**
      * post types
      */
     $post_types = get_option(WPCF_OPTION_NAME_CUSTOM_TYPES, array());
     if (array_key_exists($child_post_type, $post_types) && array_key_exists('supports', $post_types[$child_post_type])) {
         foreach ($post_types[$child_post_type]['supports'] as $key => $value) {
             $this->child_supports[$key] = (bool) $value;
         }
     }
     unset($post_types);
     /**
      * wp_enqueue_media allways
      */
     add_action('admin_enqueue_scripts', array($this, 'wp_enqueue_media'), PHP_INT_MAX);
 }
开发者ID:phuocdungit,项目名称:fundy,代码行数:57,代码来源:form-child.php

示例13: stripslashes

					echo ', ';
				$draft->post_title = stripslashes($draft->post_title);
				if ( empty($draft->post_title) )
					$draft->post_title = sprintf(__('Post # %s'), $draft->ID);
				echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
			}
			?>
			<?php if ( 15 < count($drafts) ) { ?>
			, <a href="edit.php"><?php echo sprintf(__('and %s more'), (count($drafts) - 15) ); ?> &raquo;</a>
			<?php } ?>
			.</p>
			</div>
			<?php
		}

		$post = get_default_post_to_edit();

		include('edit-form-advanced.php');
?>
<div id="wp-bookmarklet" class="wrap">
<?php echo '<h3>'.__('WordPress bookmarklet').'</h3>
<p>'.__('Right click on the following link and choose "Add to favorites" to create a posting shortcut.').'</p>'; ?>
<p>

<?php
if ($is_NS4 || $is_gecko) {
?>
<a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}location.href='<?php echo get_settings('siteurl') ?>/wp-admin/post.php?text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press It - %s'), wp_specialchars(get_settings('blogname'))); ?></a> 
<?php
} else if ($is_winIE) {
?>
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:post.php

示例14: wp_dashboard_quick_press

function wp_dashboard_quick_press()
{
    global $post_ID;
    $drafts = false;
    if ('post' === strtolower($_SERVER['REQUEST_METHOD']) && isset($_POST['action']) && 0 === strpos($_POST['action'], 'post-quickpress') && (int) $_POST['post_ID']) {
        $view = get_permalink($_POST['post_ID']);
        $edit = esc_url(get_edit_post_link($_POST['post_ID']));
        if ('post-quickpress-publish' == $_POST['action']) {
            if (current_user_can('publish_posts')) {
                printf('<div class="updated"><p>' . __('Post published. <a href="%s">View post</a> | <a href="%s">Edit post</a>') . '</p></div>', esc_url($view), $edit);
            } else {
                printf('<div class="updated"><p>' . __('Post submitted. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>') . '</p></div>', esc_url(add_query_arg('preview', 1, $view)), $edit);
            }
        } else {
            printf('<div class="updated"><p>' . __('Draft saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>') . '</p></div>', esc_url(add_query_arg('preview', 1, $view)), $edit);
            $drafts_query = new WP_Query(array('post_type' => 'post', 'post_status' => 'draft', 'author' => $GLOBALS['current_user']->ID, 'posts_per_page' => 1, 'orderby' => 'modified', 'order' => 'DESC'));
            if ($drafts_query->posts) {
                $drafts =& $drafts_query->posts;
            }
        }
        printf('<p class="easy-blogging">' . __('You can also try %s, easy blogging from anywhere on the Web.') . '</p>', '<a href="' . esc_url(admin_url('tools.php')) . '">' . __('Press This') . '</a>');
        $_REQUEST = array();
        // hack for get_default_post_to_edit()
    }
    /* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */
    $last_post_id = (int) get_user_option('dashboard_quick_press_last_post_id');
    // Get the last post_ID
    if ($last_post_id) {
        $post = get_post($last_post_id);
        if (empty($post) || $post->post_status != 'auto-draft') {
            // auto-draft doesn't exists anymore
            $post = get_default_post_to_edit('post', true);
            update_user_option(get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID);
            // Save post_ID
        } else {
            $post->post_title = '';
            // Remove the auto draft title
        }
    } else {
        $post = get_default_post_to_edit('post', true);
        $user_id = get_current_user_id();
        // Don't create an option if this is a super admin who does not belong to this site.
        if (!(is_super_admin($user_id) && !in_array(get_current_blog_id(), array_keys(get_blogs_of_user($user_id))))) {
            update_user_option($user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID);
        }
        // Save post_ID
    }
    $post_ID = (int) $post->ID;
    $media_settings = array('id' => $post->ID, 'nonce' => wp_create_nonce('update-post_' . $post->ID));
    if (current_theme_supports('post-thumbnails', $post->post_type) && post_type_supports($post->post_type, 'thumbnail')) {
        $featured_image_id = get_post_meta($post->ID, '_thumbnail_id', true);
        $media_settings['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;
    }
    ?>

	<form name="post" action="<?php 
    echo esc_url(admin_url('post.php'));
    ?>
" method="post" id="quick-press">
		<div class="input-text-wrap" id="title-wrap">
			<label class="screen-reader-text prompt" for="title" id="title-prompt-text"><?php 
    _e('Enter title here');
    ?>
</label>
			<input type="text" name="post_title" id="title" autocomplete="off" value="<?php 
    echo esc_attr($post->post_title);
    ?>
" />
		</div>

		<?php 
    if (current_user_can('upload_files')) {
        ?>
		<div id="wp-content-wrap" class="wp-editor-wrap hide-if-no-js wp-media-buttons">
			<?php 
        do_action('media_buttons', 'content');
        ?>
		</div>
		<?php 
    }
    ?>

		<div class="textarea-wrap">
			<label class="screen-reader-text" for="content"><?php 
    _e('Content');
    ?>
</label>
			<textarea name="content" id="content" class="mceEditor" rows="3" cols="15"><?php 
    echo esc_textarea($post->post_content);
    ?>
</textarea>
		</div>

		<script type="text/javascript">
		edCanvas = document.getElementById('content');
		edInsertContent = null;
		<?php 
    if ($_POST) {
        ?>
		wp.media.editor.remove('content');
//.........这里部分代码省略.........
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:101,代码来源:dashboard.php

示例15: wpcf_add_meta_boxes

/**
 * Add meta boxes.
 *
 * @param type $post_type
 * @param type $post
 * @return boolean
 */
function wpcf_add_meta_boxes($post_type, $post)
{
    // Do not add metaboxes
    if (in_array($post_type, array('view', 'view-template', 'cred-form'))) {
        return false;
    }
    //  Fix for empty $post (tabify)
    if (empty($post->ID)) {
        $post = get_default_post_to_edit($post_type, false);
    }
    // Get groups
    $groups = wpcf_admin_post_get_post_groups_fields($post);
    foreach ($groups as $group) {
        $only_preview = '';
        //If Access plugin activated
        if (function_exists('wpcf_access_register_caps')) {
            //If user can't view own profile fields
            if (!current_user_can('view_fields_in_edit_page_' . $group['slug'])) {
                continue;
            }
            //If user can modify current group in own profile
            if (!current_user_can('modify_fields_in_edit_page_' . $group['slug'])) {
                $only_preview = 1;
            }
        }
        // Process fields
        if (!empty($group['fields']) && empty($only_preview)) {
            if (defined('WPTOOLSET_FORMS_VERSION')) {
                $errors = get_post_meta($post->ID, '__wpcf-invalid-fields', true);
                $group['html'] = array();
                foreach ($group['fields'] as $field) {
                    wpcf_admin_post_add_to_editor($field);
                    $meta = get_post_meta($post->ID, $field['meta_key']);
                    $config = wptoolset_form_filter_types_field($field, $post->ID);
                    if ($errors) {
                        $config['validate'] = true;
                    }
                    if ($field['type'] == 'wysiwyg') {
                        $group['html'][] = array('config' => $config, 'meta' => $meta);
                    } else {
                        $group['html'][] = wptoolset_form_field('post', $config, $meta);
                    }
                }
                // OLD
                delete_post_meta($post->ID, 'wpcf-invalid-fields');
                delete_post_meta($post->ID, '__wpcf-invalid-fields');
            } else {
                // Process fields
                $group['fields'] = wpcf_admin_post_process_fields($post, $group['fields'], true);
            }
        }
        // Check if hidden
        if (!isset($group['__show_meta_box']) || $group['__show_meta_box'] != false) {
            // Add meta boxes
            if (empty($only_preview)) {
                add_meta_box("wpcf-group-{$group['slug']}", wpcf_translate('group ' . $group['id'] . ' name', $group['name']), 'wpcf_admin_post_meta_box', $post_type, $group['meta_box_context'], 'high', $group);
            } else {
                add_meta_box("wpcf-group-{$group['slug']}", wpcf_translate('group ' . $group['id'] . ' name', $group['name']), 'wpcf_admin_post_meta_box_preview', $post_type, $group['meta_box_context'], 'high', $group);
            }
        }
    }
}
开发者ID:SpencerNeitzke,项目名称:types,代码行数:69,代码来源:fields-post.php


注:本文中的get_default_post_to_edit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。