Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wp get acf category in post

<?php 
  $categories= get_the_category();
  if (!empty($categories)) {
    $term_id = $categories[0]->term_id;
    $image = get_field('category-image-field', 'term_'.$term_id);
    // what you do from here depends on what the field is returning
  }
?>
Comment

wp retrieve acf by category name

$category_name = get_field('category-name', $category_id);
Comment

PREVIOUS NEXT
Code Example
Php :: Skip WooCommerce Cart page and redirect to Checkout page 
Php :: is users logged in laravel blade 
Php :: install mess detector 
Php :: php find text in variable 
Php :: convert to int php 
Php :: laravel eloquent get column 
Php :: laravel migration remove unique 
Php :: Add Product Short Description To Product Category In WooCommerce 
Php :: acf gallery 
Php :: laravel 8 date difference in days 
Php :: how send parameter with command in laravel 
Php :: http error code php 
Php :: php replace every occurrence of character in string 
Php :: laravel custom 404 blade 
Php :: php echo an array to console 
Php :: password required wp 
Php :: check if session is set 
Php :: set default value for column in laravel model 
Php :: Carbon Add Days To Date In Laravel 
Php :: laravel limit relationship result 
Php :: laravel form validation 
Php :: laravel 8 Target class [FormController] does not exist. 
Php :: time to string in php 
Php :: pdo connect 
Php :: laravel validate enum field 
Php :: php sort reverse 
Php :: laravel model limit 
Php :: laravel sortby varchar date 
Php :: laravel datatable format date column 
Php :: wordpress custom post type disable add new 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =