联系我们
简单又实用的WordPress网站制作教学
当前位置:网站首页 > WordPress插件 > 正文

Pure Metafield最好的WordPress常用插件下载博客插件模块

作者:98wpeu发布时间:2023-10-19分类:WordPress插件浏览:83


导读:纯元字段安装PureMetafield插件是一个强大的工具,旨在增强WordPress网站的功能和灵活性。有了这个插件,你可以轻松地创建和管理自定义元框,向你的帖子、页面和定制帖...
纯元字段安装

Pure Metafield插件是一个强大的工具,旨在增强WordPress网站的功能和灵活性。有了这个插件,你可以轻松地创建和管理自定义元框,向你的帖子、页面和定制帖子类型添加额外的域和数据。

主要特点

✅定制元盒:轻松创建无限的定制元盒。定义每个元框的标题、位置和优先级以满足您的需要。

✅灵活的字段类型:该插件提供了广泛的字段类型可供选择,包括文本、文本区、选择、复选框、单选按钮、日期选择器等等。轻松自定义字段选项和验证规则。

✅可重复字段:启用重复字段的功能,允许用户动态添加同一字段的多个实例。非常适合需要捕获多组数据的场景。

✅条件逻辑:设置条件逻辑以根据其他字段的值显示或隐藏字段。此功能增加了多功能性,并改善了表单的用户体验。

✅内置验证:通过为您的字段实现验证规则来确保数据准确性。您可以轻松地定义必填字段、验证输入格式和定制错误消息。

✅保存和检索元数据:该插件提供了保存和检索元数据的简单功能,允许您访问和利用主题或插件中存储的信息。

✅与WordPress API的集成:与WordPress API无缝集成并扩展其功能。挂钩操作和筛选器以操作元数据并创建动态交互。

实时文档

截图带页面的元字段带产品的Metafield转发器如何编写代码安装从WordPress仪表板自动安装登录到您的管理面板导航到插件-&>添加新搜索纯金矿场分别单击安装和激活。从WordPress仪表板手动安装

如果您的服务器未连接到互联网,则可以使用此方法-

点击上面的红色按钮即可打开该插件。将下载ZIP文件。登录您的站点-S管理面板,然后导航至插件-添加新项-上传。单击选择文件,选择插件文件,然后单击安装使用Ftp安装

如果您由于互联网连接和文件权限问题而无法使用任何方法,则可以使用此方法-

点击上面的红色按钮即可打开该插件。将下载一个ZIP文件。解压缩该文件。启动您最喜欢的FTP客户端。如FileZilla、FireFTP、CyberDuck等。如果您是更高级的用户,那么您也可以使用SSH。上传文件夹以wp-content/plugins/登录到您的WordPress仪表板。导航到插件->;安装激活插件如何使用?

使用Add_Filter挂钩将代码粘贴到您的主题-S函数.php中。

Metbox Add
<?phpadd_filter( 'tp_meta_boxes', 'themepure_metabox' );function themepure_metabox( $meta_boxes ) {    $meta_boxes[] = array(        'metabox_id'       => '_your_id',        'title'    => esc_html__( 'Your Metabox Title', 'textdomain' ),        'post_type'=> 'post', // page, custom post type name        'context'  => 'normal',        'priority' => 'core',        'fields'   => array(),    );    return $meta_boxes;}?>
文本字段
<?php// text field for normal textarray(    'label' => 'Text Field',    'id'    => "_your_id",    'type'  => 'text', // specify the type field    'placeholder' => '',    'default' => '', // do not remove default key)// textarea field for large textarray(    'label' => 'Textarea Field',    'id'    => "_your_id",    'type'  => 'textarea', // specify the type field    'placeholder' => 'Type...',    'default'     => '',    'conditional' => array())?>
图像和图片库领域
<?phparray(      'label'     => esc_html__( 'Your Title', 'textdomain' ),    'id'        => "_your_id",    'type'      => 'image', // specify the type field    'default'   => '',    'conditional' => array())// Gallery field for multiple images uploadarray(    'label'    => esc_html__( 'Your Title', '' ),    'id'      => "_your_id",    'type'    => 'gallery', // specify the type field    'default' => '',    'conditional' => array())?>
切换字段
<?phparray(    'label'    => esc_html__( 'Your Title', 'textdomain' ),    'id'      => "_your_id",    'type'    => 'switch',    'default' => 'off',    'conditional' => array())?>
组按钮
<?php// multiple buttons group field like multiple radio buttons tabsarray(    'label'   => esc_html__( 'Group Buttons Tab', '' ),    'id'      => "_your_id",    'desc'    => '',    'type'    => 'tabs',    'choices' => array(        'button_1' => 'Button 1',        'button_2' => 'Button 2',        'button_3' => 'Button 3',    ),    'default' => 'button_1',    'conditional' => array())?>
选择字段
<?php// select field dropdownarray(    'label'           => esc_html__('TP Select Field', 'textdomain'),    'id'              => "_your_id",    'type'            => 'select',    'options'         => array(        '1' => 'one',        '2' => 'two ',        '3' => 'three ',        '4' => 'four ',        '5' => 'five ',    ),    'placeholder'     => 'Select an item',    'conditional' => array(),    'default' => '')?>
日期选择器字段
<?php// Datepicker for date fieldarray(    'label' => 'Datepicker',    'id'    => "_your_id",    'type'  => 'datepicker',    'placeholder' => '',    'default'     => '',    'conditional' => array())?>
拾色器
<?php// Colorpicker for color fieldarray(    'label' => 'Colorpicker',    'id'    => "_your_id",    'type'  => 'colorpicker',    'placeholder' => '',    'default'     => '',    'conditional' => array())?>
选择任何帖子类型的帖子
<?php// posts select dropdown field ( Lists any post types posts)array(    'label'           => esc_html__('TP Posts Select', 'textdomain'),    'id'              => "_your_id",    'type'            => 'select_posts',    'post_type'       => 'post', // specify the post type you want to fetch    'placeholder'     => 'Select a post',    'conditional' => array(),    'default' => '')?>
中继器

在上面的代码示例中,字段数组将中继器数组粘贴到字段数组内

<?phparray(    'label'     => esc_html__('Field Title', 'textdomain'),    'id'        => "_your_id",    'type'      => 'repeater', // specify the type "repeater" (case sensitive)    'conditional'   => array(),    'default'       => array(),    'fields'        => array(        array(            'label'           => esc_html__('Your Title', 'textdomain'),            'id'              => "_your_id",            'type'            => 'select',            'options'         => array(                'footer_1' => 'Footer 1',                'footer_2' => 'Footer 2',                'footer_3' => 'Footer 3'            ),            'placeholder'     => 'Select a footer',            'conditional' => array(),            'default' => 'footer_1',        ),        array(            'label'           => esc_html__('Select Footer Style', 'textdomain'),            'id'              => "_footer_style_2",            'type'            => 'select',            'options'         => array(                'footer_1' => 'Footer 1',                'footer_2' => 'Footer 2',                'footer_3' => 'Footer 3'            ),            'placeholder'     => 'Select a footer',            'conditional' => array(),            'default' => 'footer_1',            'bind'    => "_footer_template_2" // bind the key to be control with conditions        ),        array(            'label'           => esc_html__('Select Footer Template', 'textdomain'),            'id'              => "_footer_template_2",            'type'            => 'select_posts',            'placeholder'     => 'Select a template',            'post_type'       => 'tp-footer',            'conditional' => array(                "_footer_style_2", "==", "footer_2" // First parameter will be the id of control field and so on            ),            'default' => '',        )    ))?>
条件字段
<?phparray(    'label'     => 'Text Field',    'id'        => "_your_id",    'type'      => 'text',    'placeholder'   => '',    'default'       => '',    'conditional'   => array(        "_id_of_any_field", "any operator", "value_of_that_field"    ))array(    'label'     => 'Text Field',    'id'        => "_your_id",    'type'      => 'text',    'placeholder'   => '',    'default'       => '',    'conditional'   => array(        "_field_id", "==", "_field_value"    ))?>
对于使用POST格式进行绑定
<?phpadd_filter( 'tp_meta_boxes', 'themepure_metabox' );function themepure_metabox( $meta_boxes ) {    $meta_boxes[] = array(        'metabox_id'       => $prefix . '_post_meta_gallery_box',        'title'    => esc_html__( 'Post Meta Gallery', 'donafund' ),        'post_type'=> 'post',        'context'  => 'normal',        'priority' => 'core',        'fields'   => array(            array(                'label'    => esc_html__( 'Gallery Format', 'textdomain' ),                'id'      => "{$prefix}_gallery_5",                'type'    => 'gallery',                'default' => '',                'conditional' => array(),            ),        ),        'post_format' => 'gallery' // if u want to bind with post formats    );    $meta_boxes[] = array(        'metabox_id'       => $prefix . '_post_meta_audio_box',        'title'    => esc_html__( 'Post Meta Audio', 'donafund' ),        'post_type'=> 'post',        'context'  => 'normal',        'priority' => 'core',        'fields'   => array(            array(                'label' => esc_html__( 'Audio Format', 'donafund' ),                'id'    => "{$prefix}_audio_format",                'type'  => 'text',                'placeholder' => esc_html__( 'Audio url here', 'donafund' ),                'default'     => '',                'conditional' => array()            ),        ),        'post_format' => 'audio' // if u want to bind with post formats    );    $meta_boxes[] = array(        'metabox_id'       => $prefix . '_post_meta_video_box',        'title'    => esc_html__( 'Post Meta Video', 'donafund' ),        'post_type'=> 'post',        'context'  => 'normal',        'priority' => 'core',        'fields'   => array(            array(                'label' => esc_html__( 'Video Format', 'donafund' ),                'id'    => "{$prefix}_video_format",                'type'  => 'text',                'placeholder' => esc_html__( 'Video url here', 'donafund' ),                'default'     => '',                'conditional' => array()            ),        ),        'post_format' => 'video' // if u want to bind with post formats    );    return $meta_boxes;}?>
获取当前帖子的元值
<?php$value = function_exists('tpmeta_field')? tpmeta_field('meta_key_id_here') : '';?>
获取特定帖子的元值
<?php$value = function_exists('tpmeta_field')? tpmeta_field('meta_key_id_here', $post_id) : '';?>
获取图库图像
<?php$tp_gallery_images = function_exists('tpmeta_gallery_field') ? tpmeta_gallery_field('gallery_meta_key') : ''; //tpmeta_gallery_field($string_ids, $size)foreach($tp_gallery_images as $single_image_src){    echo $single_image_src['url'] ."<br>";    echo $single_image_src['alt'] ."<br>";}?>
获取单一图像
<?php$tp_image = function_exists('tpmeta_image_field') ? tpmeta_image_field('image_meta_key') : ''; // tpmeta_image_field($id, $size)echo $tp_image['url'];echo $tp_image['alt'];?>
获取中继器数据
<?php$tp_repeater = function_exists('tpmeta_field') ? tpmeta_field('repeater_meta_key') : ''; // tpmeta_field($meta_key, $post_id)foreach($tp_repeater as $row){ // Iterate the data with loop    echo $row['repeater_sub_field_key'] // get the subfield value by repeater inner array field key}?>
访问中继器内的单个图像和图库图像
<?php$tp_repeater = function_exists('tpmeta_field') ? tpmeta_field('repeater_meta_key') : ''; // tpmeta_field($meta_key, $post_id)foreach($tp_repeater as $row){ // Iterate the data with loop     $gallery = tpmeta_gallery_images($row['repeater_sub_field_key'], 'image_size');      $image = tpmeta_image($row['repeater_sub_field_key'], 'image_size');}?>
常见问题解答:什么是WordPress中的元框?

元框是WordPress后端中的一个用户界面元素,允许您向帖子、页面或自定义帖子类型添加额外的字段和数据。它提供了一种方法来扩展WordPress的默认功能,并捕获与您的内容相关的附加信息。

为什么我需要一个元盒插件?

元框插件,如WordPress Meta Box插件,提供了一种用户友好且高效的方式来创建和管理定制的元框。它消除了手动编码的需要,并为添加字段、定义字段类型以及实现验证和条件逻辑提供了灵活的界面。使用插件可以节省您的时间和精力,同时增强您的WordPress网站的功能和定制选项。

我可以创建多个元框吗?

是的,WordPress Meta Box插件允许您创建无限制的自定义Meta Box。您可以定义每个元框的标题、位置和优先级,以根据您的特定要求组织和显示其他字段。

插件中有哪些字段类型可用?

该插件提供了广泛的字段类型可供选择,包括文本、文本区、选择、复选框、单选按钮、日期选择器等。您可以根据要捕获的数据类型,为每个元框选择最合适的字段类型。

我可以重复元框中的字段吗?

是的,该插件支持可重复的字段。这意味着您可以启用该选项来动态添加同一字段的多个实例。当您需要捕获多组数据(例如多个地址或多个相关项)时,它尤其有用。

如何将条件逻辑应用于我的元框?

WordPress Meta Box插件提供了一种为您的字段设置条件逻辑的简单方法。您可以定义规则以根据其他字段的值显示或隐藏字段。此功能允许您创建动态交互,并仅向用户显示相关字段。

我可以验证我的元框字段的输入数据吗?

是的,该插件包括内置的验证功能。您可以为您的字段定义验证规则,例如必填字段、输入格式限制和自定义错误消息。这保证了用户输入的数据符合您的特定要求,提高了数据的准确性。

如何访问插件保存的元数据?

WordPress Meta Box插件提供了保存和检索元数据的简单功能。您可以使用提供的函数轻松访问主题或插件中存储的信息,允许您将元数据用于各种目的,如显示自定义信息或执行计算。

该插件是否与WordPress API兼容?

是的,该插件与WordPress API无缝集成。您可以通过连接到操作和筛选器来利用其功能来操作元数据和创建动态交互。这种集成为扩展和定制您的WordPress网站提供了广泛的可能性。

我在哪里可以找到支持或报告问题?

如需支持或报告任何问题,请访问插件-S GitHub存储库并打开新的问题。我们致力于提供帮助并解决您在使用该插件时可能遇到的任何问题。

我能为外挂-S的发展贡献一份力量吗?

是的,欢迎投稿!如果你对这个插件有任何想法或改进,请随时在插件-S GitHub资源库上提交拉取请求。我们感谢社区的参与,并重视您的建议,让插件变得更好。

没有关于这个插件的评论。

标签:重量插件创建纯正元矿场


WordPress插件排行
最近发表
网站分类
标签列表