搜索附件  
吾侪 附件中心 吾侪生活 WordPress advanced-custom-fields.6.1.7.zip

板块导航

热门下载

advanced-custom-fields.6.1.7.zip

 

wordpress网站自定义文章等类型的插件:
wordpress网站自定义文章等类型的插件
文档 ACF 入门入门

最后更新 Jun 26, 2023
链接到标题#概述
链接到标题#欢迎
高级自定义字段是一个WordPress插件,允许您将额外的内容字段添加到WordPress编辑屏幕。这些额外的内容字段通常称为自定义字段,可以让您更快地构建网站并更快地教育您的客户。在本指南中,你将了解如何:
  • 安装 ACF 插件
  • 创建新字段
  • 创建字段内容
  • 在模版中显示字段
  • 注册自定义帖子类型和分类
链接到标题#基础知识
自定义字段是WordPress的本机部分,出现在页面,帖子和自定义帖子类型中,但是,本机自定义字段界面不是很用户友好。安装 ACF 后,您可以自定义要显示的字段及其外观。例如,您可能需要为主页选择“英雄图像”。您可以使用ACF轻松创建此图像字段,并在编辑主页时显示它!以下是本机自定义字段和高级自定义字段之间的区别。




链接到标题#安装
高级自定义字段插件没有预装在 WordPress 中,因此您需要在使用其出色的功能之前安装我们的插件!幸运的是,WordPress使这个过程变得非常简单!如果您熟悉WordPress,只需登录到您的网站并从插件页面搜索/安装高级自定义字段插件即可。有关详细说明,请阅读我们的分步说明指南
链接到标题#创建字段
创建新的自定义字段是一个非常简单的过程,只需单击几下我们用户友好的字段构建器即可完成!您可以根据需要创建任意数量的字段,每个字段都有自己的名称、类型和设置。每个字段都添加到一个组中,该组允许您组织字段并指定它们显示的编辑屏幕。
字段组用于组织字段并将其附加到编辑屏幕。每个字段组都包含标题、字段、位置规则和视觉设置。要开始使用您的第一个字段组,请阅读我们的创建字段组指南






每个字段都包含用于自定义字段外观(其类型)、其值的保存位置(其名称)以及其功能(其设置)的设置。编辑字段组时,可以自定义这些字段设置。要了解有关字段设置的更多信息,请阅读我们的字段设置指南
链接到标题#创建内容
创建字段后,就可以开始编辑内容了!我们所有的字段都非常直观,使用起来,并与WordPress管理风格无缝显示。您无需触发任何事件即可显示或编辑自定义字段,它们将显示和功能,就像WP post_title和post_content字段一样!只需输入您的内容并更新帖子!
字段不仅可用于帖子!您还可以在页面上显示自定义字段,自定义帖子类型,用户,分类术语,评论,媒体和自定义选项页面

要了解您可以在 ACF 中编辑的不同内容,请查看可用的字段类型
链接到标题#显示字段
显示字段值是ACF的派对作品!任何字段值都可以作为 PHP 变量返回,也可以通过神奇的函数和 HTML 输出为 HTML。这些功能(以及许多其他功能)提供了一种开发人员友好的方式来自定义您的 WordPress 主题,而无需花费数小时阅读我们的文档!以下是一些示例代码,以了解我们直观的 API 的工作原理!get_field()the_field()
<h1><?php the_title(); ?></h1><?php if( get_field('sub_heading') ): ?>    <h2><?php the_field('sub_heading'); ?></h2><?php endif; ?><div class="hero">    <?php $image = get_field('hero_image'); ?>    <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /></div><?php if( have_rows('event') ): ?>    <ul>    <?php while( have_rows('event') ): the_row(); ?>        <li>            <a href="<?php the_sub_field('url'); ?>"><?php the_sub_field('title'); ?></a>        </li>    <?php endwhile; ?>    </ul><?php endif; ?>
To learn more about our API, please see our Functions and check out our Code Examples guide.
Link to heading#Custom Post Types and Taxonomies
Custom post types and taxonomies turn WordPress into a full content management system. Post types give you much greater control over how your content is created, customized, displayed, and managed. Taxonomies give you the same power over how your data and content is organized and categorized.
ACF allows you to register your custom post types and taxonomies directly in the plugin. This greatly simplifies workflows by avoiding the need to register them manually with code or use another plugin. Just create a post type in the UI, then follow it up by adding an existing field group, creating a new field group and defining fields, or by creating a taxonomy.

                               
登录/注册后可看大图
请参阅帖子类型和分类法以获取我们的深入指南。
链接到标题#教育与支持
干得好!本指南涵盖了开始使用高级自定义字段插件进行创建的所有基础知识,但我们只是触及了可用资源的表面。随着您对ACF的更多工作,您会发现新的特性,功能,甚至是强大的PRO功能套件,可以帮助您将WordPress网站提升到一个新的水平。如果您有本指南中未解决的任何问题,请访问我们的资源中心了解更多信息或直接联系我们的支持团队


在此页面上
在此类别中





大约
帮助
社区
产品







<h1><?php the_title(); ?></h1>

<?php if( get_field('sub_heading') ): ?>
    <h2><?php the_field('sub_heading'); ?></h2>
<?php endif; ?>

<div class="hero">
    <?php $image = get_field('hero_image'); ?>
    <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
</div>

<?php if( have_rows('event') ): ?>
    <ul>
    <?php while( have_rows('event') ): the_row(); ?>
        <li>
            <a href="<?php the_sub_field('url'); ?>"><?php the_sub_field('title'); ?></a>
        </li>
    <?php endwhile; ?>
    </ul>
<?php endif; ?>

邮箱|首页|小黑屋|吾侪 ( 蜀ICP备2020029307号-4 )

GMT+8, 2025-10-20 12:11 , Processed in 0.071413 second(s), 15 queries , APCu On.

Powered by Discuz! X3.5

Copyright © , 吾侪网

返回顶部