• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_caption_input_textarea函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: wpsc_attachment_fields_filter

 public static function wpsc_attachment_fields_filter($form_fields, $post)
 {
     if (!$post->post_parent) {
         return $form_fields;
     }
     $parent = get_post($post->post_parent);
     if ($parent->post_type !== 'wpsc-product') {
         return $form_fields;
     }
     $edit_post = sanitize_post($post, 'edit');
     if (is_array($form_fields) && count($form_fields) > 0) {
         $number_field = 0;
         $field_post_excerpt = array('label' => 'Caption', 'input' => 'html', 'html' => wp_caption_input_textarea($edit_post));
         foreach ($form_fields as $form_key => $form_values) {
             if ($number_field == 1 && is_array($field_post_excerpt)) {
                 $new_form_fields['post_excerpt'] = $field_post_excerpt;
                 $field_post_excerpt = '';
             }
             $new_form_fields[$form_key] = $form_values;
             $number_field++;
         }
         $form_fields = $new_form_fields;
     }
     $exclude_image = (int) get_post_meta($post->ID, '_wpsc_exclude_image', true);
     $label = __('Exclude image', 'wpsc_dgallery');
     $html = '<input type="checkbox" ' . checked($exclude_image, 1, false) . ' name="attachments[' . $post->ID . '][wpsc_exclude_image]" id="attachments[' . $post->ID . '][wpsc_exclude_image]" />';
     $form_fields['wpsc_exclude_image'] = array('label' => $label, 'input' => 'html', 'html' => $html, 'value' => '', 'helps' => __('Enabling this option will hide it from the product page image gallery. If assigned to variations below the image will show when option is selected. (Show Product Variations in Gallery is a', 'wpsc_dgallery') . ' <a href="http://a3rev.com/shop/wp-e-commerce-dynamic-gallery/" target="_blank">' . __('Pro Version', 'wpsc_dgallery') . '</a> ' . __('only feature', 'wpsc_dgallery') . ')');
     return $form_fields;
 }
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:29,代码来源:class-wpsc-dynamic-gallery-hook-filter.php


示例2: get_attachment_fields_to_edit

/**
 * {@internal Missing Short Description}}
 *
 * @since 2.5.0
 *
 * @param object $post
 * @param array $errors
 * @return array
 */
function get_attachment_fields_to_edit($post, $errors = null)
{
    if (is_int($post)) {
        $post = get_post($post);
    }
    if (is_array($post)) {
        $post = new WP_Post((object) $post);
    }
    $image_url = wp_get_attachment_url($post->ID);
    $edit_post = sanitize_post($post, 'edit');
    $form_fields = array('post_title' => array('label' => __('Title'), 'value' => $edit_post->post_title), 'image_alt' => array(), 'post_excerpt' => array('label' => __('Caption'), 'input' => 'html', 'html' => wp_caption_input_textarea($edit_post)), 'post_content' => array('label' => __('Description'), 'value' => $edit_post->post_content, 'input' => 'textarea'), 'url' => array('label' => __('Link URL'), 'input' => 'html', 'html' => image_link_input_fields($post, get_option('image_default_link_type')), 'helps' => __('Enter a link URL or click above for presets.')), 'menu_order' => array('label' => __('Order'), 'value' => $edit_post->menu_order), 'image_url' => array('label' => __('File URL'), 'input' => 'html', 'html' => "<input type='text' class='text urlfield' readonly='readonly' name='attachments[{$post->ID}][url]' value='" . esc_attr($image_url) . "' /><br />", 'value' => wp_get_attachment_url($post->ID), 'helps' => __('Location of the uploaded file.')));
    foreach (get_attachment_taxonomies($post) as $taxonomy) {
        $t = (array) get_taxonomy($taxonomy);
        if (!$t['public'] || !$t['show_ui']) {
            continue;
        }
        if (empty($t['label'])) {
            $t['label'] = $taxonomy;
        }
        if (empty($t['args'])) {
            $t['args'] = array();
        }
        $terms = get_object_term_cache($post->ID, $taxonomy);
        if (false === $terms) {
            $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
        }
        $values = array();
        foreach ($terms as $term) {
            $values[] = $term->slug;
        }
        $t['value'] = join(', ', $values);
        $form_fields[$taxonomy] = $t;
    }
    // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
    // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
    $form_fields = array_merge_recursive($form_fields, (array) $errors);
    // This was formerly in image_attachment_fields_to_edit().
    if (substr($post->post_mime_type, 0, 5) == 'image') {
        $alt = get_post_meta($post->ID, '_wp_attachment_image_alt', true);
        if (empty($alt)) {
            $alt = '';
        }
        $form_fields['post_title']['required'] = true;
        $form_fields['image_alt'] = array('value' => $alt, 'label' => __('Alternative Text'), 'helps' => __('Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;'));
        $form_fields['align'] = array('label' => __('Alignment'), 'input' => 'html', 'html' => image_align_input_fields($post, get_option('image_default_align')));
        $form_fields['image-size'] = image_size_input_fields($post, get_option('image_default_size', 'medium'));
    } else {
        unset($form_fields['image_alt']);
    }
    /**
     * Filter the attachment fields to edit.
     *
     * @since 2.5.0
     *
     * @param array   $form_fields An array of attachment form fields.
     * @param WP_Post $post        The WP_Post attachment object.
     */
    $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post);
    return $form_fields;
}
开发者ID:HaraShun,项目名称:WordPress,代码行数:69,代码来源:media.php


示例3: get_attachment_fields_to_edit

/**
 * {@internal Missing Short Description}}
 *
 * @since 2.5.0
 *
 * @param unknown_type $post
 * @param unknown_type $errors
 * @return unknown
 */
function get_attachment_fields_to_edit($post, $errors = null)
{
    if (is_int($post)) {
        $post =& get_post($post);
    }
    if (is_array($post)) {
        $post = (object) $post;
    }
    $image_url = wp_get_attachment_url($post->ID);
    $edit_post = sanitize_post($post, 'edit');
    $form_fields = array('post_title' => array('label' => __('Title'), 'value' => $edit_post->post_title), 'image_alt' => array(), 'post_excerpt' => array('label' => __('Default Caption'), 'input' => 'html', 'html' => wp_caption_input_textarea($edit_post)), 'post_content' => array('label' => __('Description'), 'value' => $edit_post->post_content, 'input' => 'textarea'), 'url' => array('label' => __('Link URL'), 'input' => 'html', 'html' => image_link_input_fields($post, get_option('image_default_link_type')), 'helps' => __('Enter a link URL or click above for presets.')), 'menu_order' => array('label' => __('Order'), 'value' => $edit_post->menu_order), 'image_url' => array('label' => __('File URL'), 'input' => 'html', 'html' => "<input type='text' class='text urlfield' readonly='readonly' name='attachments[{$post->ID}][url]' value='" . esc_attr($image_url) . "' /><br />", 'value' => wp_get_attachment_url($post->ID), 'helps' => __('Location of the uploaded file.')));
    foreach (get_attachment_taxonomies($post) as $taxonomy) {
        $t = (array) get_taxonomy($taxonomy);
        if (!$t['public']) {
            continue;
        }
        if (empty($t['label'])) {
            $t['label'] = $taxonomy;
        }
        if (empty($t['args'])) {
            $t['args'] = array();
        }
        $terms = get_object_term_cache($post->ID, $taxonomy);
        if (empty($terms)) {
            $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
        }
        $values = array();
        foreach ($terms as $term) {
            $values[] = $term->name;
        }
        $t['value'] = join(', ', $values);
        $form_fields[$taxonomy] = $t;
    }
    // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
    // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
    $form_fields = array_merge_recursive($form_fields, (array) $errors);
    $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post);
    return $form_fields;
}
开发者ID:netconstructor,项目名称:WordPress-1,代码行数:48,代码来源:media.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_car_manager函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_can_install_language_pack函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap