I have this loop requesting some info from a option page:
<?php while(has_sub_field('categorias', 'option')): ?>
/* <?php echo get_sub_field('categoria')->slug; ?> */
#wrap .bg-<?php echo get_sub_field('categoria')->term_id; ?> {
background: <?php echo get_sub_field('cor'); ?>;
color: <?php echo get_sub_field('texto'); ?> !important;
}
#wrap .bg-<?php echo get_sub_field('categoria')->term_id; ?>:after {
background: <?php echo get_sub_field('cor'); ?>;
}
#wrap .pseudo-<?php echo get_sub_field('categoria')->term_id; ?>:before {
background: <?php echo get_sub_field('cor'); ?>;
}
#wrap .content.cat-<?php echo get_sub_field('categoria')->term_id; ?> a:before {
background: <?php echo get_sub_field('cor'); ?>;
}
<?php endwhile; ?>
Since this query rarely receive updates, can I optimize and cache the results? Mabe WP Transients API?