OK, so I tried the JavaScript route and despite lots of excellent help, I couldn’t achieve what I needed.
Basically, I’m running a WordPress site, hosted locally. It is to be used as a database containing details about sites we serve – things like IP Address, OS, Ram etc.
Im using a plugin called “advanced custom fields” which is where the information goes into. The fields can be displayed on the page by manually inserting <?php the_field(‘field_name’); ?> into the template.
Now each of these fields that I have put into the single.php (template for a single post) are wrapped in <divs> purely so I can add some style to them to look more presentable on the site.
The one and only problem I am facing is that, as there are 40+ of these <divs> containing the php field embed codes, some of them will not be filled in. Now I want to be able to hide these <divs> if they are empty just to avoid headaches trying to scroll past 20 blank boxes looking for info on the post, but its proving quite difficult for me as I am quite new to coding.
Here is the code from a forum on the plugins site, which in theory hides the “Price: ” if it is empty.
[CODE]<?php if (get_field(‘price’) != “”) { ?>
Price: <?php the_field (‘price’); } ?>
Now here is how mine is displayed (just a small excerpt):
[CODE]
<div class=”post3″ >
<strong>Host Control Software Details</strong><br />
<div class=”inside”><?php the_field(‘host_control’); ?></div>
</div>
<div class=”post3″ >
<strong>Respak Software Details</strong><br />
<div class=”inside”><?php the_field(‘respak_details’); ?></div>
</div>
<div class=”post3″ >
<strong>QSR Software Details</strong><br />
<div class=”inside”><?php the_field(‘hostess_details’); ?></div>
</div>
How do I use “<?php if (get_field(‘field name’) != “”) { ?>” with my coding above with regards to hiding the entire “post3” DIV fir the specific field output?