‘dist’ Folder not making it to Production

The Problem

You’re using Sage (8.5.x) and when you push to production the styles on the site are not displaying. It’s because all the stylesheets and CSS maps are not actually making it to Production.

The Solution

Sage has its own .gitignore file in its root directory. This threw me off for a bit because I had my own .gitignore in the WordPress root directory and it didn’t occur to me at first that Sage would have its own.

Open up Sage’s .gitignore and remove ‘dist’ and save. When you go to push your code, you should see ‘dist’ and its files ready to be committed.

 

Advertisements

ACF Hide Field if Empty

How to ignore or hide a field if it has no value?

This comes in handy with fields that are not required by the CMS user to fill out and will sometimes remain blank.

<?php if (get_field('email')): ?> 
   <?php the_field('email'); ?> 
<?php endif; ?>

Or if it is a sub field inside of the repeater loop.

<?php if (get_sub_field('email')): ?> 
   <?php the_sub_field('email'); ?> 
<?php endif; ?>

ACF Repeater Loop Ready for HTML

Why is this needed?

I use this loop all the time and I always have to close out each line of PHP in order to pepper it with my markup. So this is just a way to save a little time.

<?php if( have_rows('repeater_field_name') ): ?>
   <?php while ( have_rows('repeater_field_name') ) : the_row(); ?>
      <?php the_sub_field('sub_field_name'); ?>
   <?php endwhile; ?>
<?php else: ?>
   <!-- there are no rows -->
<?php endif; ?>