Hiding a button, using a result of a custom field

Hi There,

Newbie post alert!!I look after a clients website with a bespoke booking system on wordpress

currently they have a loop that can desplay events and marks the ticket button correctly if ‘sold out’

this is the code for that

 $options = get_field('sold_out_option');
 if($options[0]==NULL){
 if (get_field('link_event')!=NULL){$link_url=get_field('link_event');}else{$link_url = get_permalink();} echo '<a class="book-tickets" href="'.$link_url.'">BOOK TICKETS</a>';}else{echo '<a class="sold-out" href="javascript:void(0)">SOLD OUT</a>';
 }

They need to add an option to hide the button altogether with certain events.

This is the code I am using

$options = get_field('sold_out_option');															if($options[0]==NULL){														if (get_field('link_event')!=NULL){$link_url=get_field('link_event');}else{$link_url = get_permalink();}																echo '<a class="book-tickets" href="'.$link_url.'">BOOK TICKETS</a>';															}else{																echo '<a class="sold-out" href="javascript:void(0)">SOLD OUT</a>';															} 
    if( get_field('hide_button_option') == 'NO' ){echo '<a class="hideticketbutton" href="#"></a>';}

Just doesnt seem to work, I have checked that I am correctly getting the ‘hide_button_option’ and i have also checked the css class (which is just a class set to dispaly none).

Anyone that could point me in the right direction, i would be most grateful.
11

// We'll use jQuery to create the script

// First we'll target the WooCommerce button
jQuery('.woo-commerce-button').click(function() {

// If the WooCommerce button is sold out, then we'll add a class to it that will add the grey effect
   if (jQuery(this).hasClass('sold-out')) {
      jQuery(this).addClass('greyed-out');
   }
});
Sponsor our Newsletter | Privacy Policy | Terms of Service