Skip to content

Instantly share code, notes, and snippets.

View edveraxo's full-sized avatar
🏠
Working from home

Edward Veraxo edveraxo

🏠
Working from home
View GitHub Profile
@edveraxo
edveraxo / ACF image size
Last active April 22, 2023 18:26 — forked from crondeau/ACF-img-size
Display different image size using ACF
//To display an image using ACF, one would set the image custom field to image url and call the img as follows:
<?php if( get_field( 'field_name' ) ): ?>
<?php while( has_sub_field( 'field_name' ) ): ?>
<img src="<?php the_sub_field( 'image' ); ?>" alt="">
<?php endwhile; ?>
@edveraxo
edveraxo / ACF Rule All children cats from parent
Created April 22, 2023 18:24 — forked from antiden/ACF Rule All children cats from parent
ACF Rule for all children categories from parent
/*ACF taxonomy parent*/
// category ancestor location rule
add_filter('acf/location/rule_types', 'acf_location_types_category_ancestor');
function acf_location_types_category_ancestor($choices)
{
if (!isset($choices['Post']['post_category_ancestor'])) {
$choices['Post']['post_category_ancestor'] = 'Post Category Ancestor';
}
return $choices;
}