function sub_menu_industry_products_feat_func($atts) {
$atts = shortcode_atts( array( 'feat_img_slug' => ''), $atts );
$term_id = $atts["feat_img_slug"];
// term id is being fetched here ....
return get_term_by( 'id', $term_id, 'industry_product' )->name;
}
add_shortcode('sub_menu_industry_products_feat', 'sub_menu_industry_products_feat_func');




uj5u.com熱心網友回復:
檢查有關 ACF 插件選項的鏈接。https://www.advancedcustomfields.com/resources/get_field/
此示例顯示了各種 $post_id 值,以從帖子、用戶、術語和選項中獲取值。
$post_id = false; // current post
$post_id = 1; // post ID = 1
$post_id = "user_2"; // user ID = 2
$post_id = "category_3"; // category term ID = 3
$post_id = "event_4"; // event (custom taxonomy) term ID = 4
$post_id = "option"; // options page
$post_id = "options"; // same as above
$value = get_field( 'my_field', $post_id );
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/409312.html
標籤:
