WordPress Tutorial

Advanced Custom Fields Advanced Article Custom Fields Plug in

 Alibaba Cloud

Advanced Custom Fields is a particularly powerful custom field plug-in that allows you to add various forms of custom field types, such as Image Checkbox, File, Text, Select, True/False, Link, Textarea, etc. can be integrated into one or more panels, support exporting fields as xml or php codes, and can also be integrated into themes or plug-ins. You can use this WORDPRESS plug-in to create custom fields for pages, articles, categories, and users.

It is necessary for the foreground to obtain the content of the corresponding custom field

Want to be here? contact us bar
 Maker host
  1.  <? php the_field ( 'Field name' ) ;  ?>

If you only want to obtain its value without output, you can use the following call tags:

  1.  <? php get_field ( 'team-img' ) ;  ?>

For example, if you want to obtain the field "_fengmiantu" you created in the category ID of 1, you can write as follows:

  1.  <? php the_field ( '_fengmiantu' ,  'category_1' ) ;  ?>

If you are on the classification list page, you can use the ID acquisition method to automatically obtain the fields corresponding to different classifications. You can write this way;

  1.  <? php $thiscat  = get_category ( $cat ) ;  ?> <? php the_field ( 'Your field name' , $thiscat ) ; ?>

The method to get the category custom field from the custom article type category page:

  1.  <? php
  2.  $queried_object  = get_queried_object ( ) ;
  3.  $taxonomy  =  $queried_object -> taxonomy ;
  4.  $term_id  =  $queried_object -> term_id ;
  5.  ?>
  6.  /**Use the following code where you need to get the field**/
  7.  <? php the_field ( '_fmt' , $taxonomy  .  '_'  .  $term_id ) ; ?>
  8.  /**Just change _fmt to your field name**/

2. The custom article type article page gets the fields of the custom category

  1.  <? php
  2.  $term_list  = wp_get_post_terms ( $post -> ID ,  'product_category' ,  array ( "fields"  =>  "all" ) ) ;
  3.  /**Product_category is the name of your custom taxonomy**/
  4.  $term_id  =  $term_list [ zero ] -> term_taxonomy_id  ; ?>
  5.  /**Use the following code where you need to get the field**/
  6.  <? php the_field ( '_fmt' , product_category .  '_'  .  $term_id ) ; ?>
  7.  /**Just change _fmt to your field name (product_category is the name of your custom taxonomy, which can be changed according to your situation)**/
  8.  ?>

Advanced Custom Fields Advanced Article Custom Fields Plug in

156 people have bought
View Demo Upgrade VIP Buy Now

Collection
fabulous ( zero )

Post reply

Hot selling template

Ashade - Works exhibition photo album WordPress Chinese theme
 LensNews

This site accepts WordPress/PbootCMS/DedeCMS, etc
System construction, imitation, development, customization and other services!