💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
Advanced Custom Fields,即ACF,对于定制wordpress后台用户交换具有很大优势。 【案例如图】: ![](https://box.kancloud.cn/24ec892a8c41490a54d5fb61ad0cc736_1589x565.png) 如果在指定的当前页,可以省略指定页面ID,显示代码为: `<?php the_field('text'); ?>` 参考: https://www.advancedcustomfields.com/resources/the_field/ 显示在其他页面options page内容: `<?php the_field('field_name', 'option'); ?>` 参考: https://www.advancedcustomfields.com/add-ons/options-page/ 案例代码参考: https://www.advancedcustomfields.com/resources/code-examples/ 【Tab功能】 【图片】 ~~~ <?php $image = get_field('image1'); if( !empty($image) ): ?> <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> <?php endif; ?> ~~~ 【相册】 ~~~ <?php $images = get_field('gallery'); if( $images ): ?> <?php endif; ?> <!-- $size (thumbnail, medium, large, full or custom size) --> <?php foreach( $images as $image ): ?> <div class="ps-product__image"> <img src="<?php echo $image['sizes']['large']; ?>" alt="<?php echo $image['alt']; ?>" /> </div> <?php endforeach; ?> ~~~ 参考: https://www.advancedcustomfields.com/resources/gallery/ 【增加post type页面】 主目录 https://www.advancedcustomfields.com/resources/acf_add_options_page/ 子目录 https://www.advancedcustomfields.com/resources/acf_add_options_sub_page/