Answers for "get_field taxonomy acf"

PHP
1

retrive acf from taxonomy

<?php // ACF in Taxonomy

// get the current taxonomy term
$term = get_queried_object();


// vars
$image = get_field('image', $term);
$color = get_field('color', $term);

?>
<style type="text/css">
	
	.entry-title a {
		color: <?php echo $color; ?>;
	}
	
	<?php if( $image ): ?>
	.site-header {
		background-image: url(<?php echo $image['url']; ?>);
	}
	<?php endif; ?>
	
</style>
<div class="wrap">
	
	<?php // Remaining template removed from example ?>
Posted by: Guest on May-13-2020
1

get field of acf texonomy

<?php 

// load thumbnail for this taxonomy term
$thumbnail = get_field('thumbnail', $term->taxonomy . '_' . $term->term_id);

?>
Posted by: Guest on February-03-2021
0

get_field taxonomy

<?php
/**
 * The template for displaying category archive pages
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Seventeen
 * @since 1.0
 * @version 1.0
 */

get_header(); 


// get the current taxonomy term
$term = get_queried_object();


// vars
$image = get_field('image', $term);
$color = get_field('color', $term);

?>
<style type="text/css">
	
	.entry-title a {
		color: <?php echo $color; ?>;
	}
	
	<?php if( $image ): ?>
	.site-header {
		background-image: url(<?php echo $image['url']; ?>);
	}
	<?php endif; ?>
	
</style>
<div class="wrap">
	
	<?php // Remaining template removed from example ?>
Posted by: Guest on September-28-2021

Browse Popular Code Answers by Language