Support

Account

Forum Replies Created

  • As far as I remember – I deleted the original field which had a required status (and probably with some pages still having entries for it) and then, a couple of days later, I recreated the field without the required status?

  • After a while of plugging away I managed it, for anyones future reference:

    <?php 
    	
    	$weekdays = array(
    		'monday' => 'Monday',
    		'tuesday' => 'Tuesday',
    		'wednesday' => 'Wednesday',
    		'thursday' => 'Thursday',
    		'friday' => 'Friday',
    		'saturday' => 'Saturday',
    		'sunday' => 'Sunday',
    	);
    ?>
    
    <?php 
     
    foreach($weekdays as $day):
     
    // args
    $args = array(
    	'numberposts' => -1,
    	'post_type' => 'activity',
    	//'meta_key' => 'day',
    	//'meta_value' => $day	
    	'meta_query' =>  array(
    		array(
    			'key' => 'day',
    			'value' => $day,
    			'compare' => 'LIKE'
    		)
    	)	
    	
    );
     
    // get results
    $the_query = new WP_Query( $args );
     
    // The Loop
    ?>
    <?php if( $the_query->have_posts() ): ?>
    <div class="day-container<?php echo strtolower(date('l')) == strtolower($day) ? ' active' : ''; ?>">
    <span class="day"><?php echo substr($day,0,2); ?><span class="not-mobile"><?php echo substr($day,2); ?></span></span>
    
    <ul>
    	<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    		<li class="<?php echo strtolower(get_the_title()); ?>">
    			<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    		</li>
    	<?php endwhile; ?>
    	</ul>
    
    </div>
    
    	
    
     
    <?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>
    <?php endif; ?>
    
     <?php endforeach; ?>
  • Sorry forgot to add code. I have this for my archive page:

    <?php 
     
    // args
    $args = array(
    	'numberposts' => -1,
    	'post_type' => 'activity',
    	'meta_query' => array(
    			'key' => 'day',
    			'compare' => '='
    		)
    	
    );
     
    // get results
    $the_query = new WP_Query( $args );
     
    // The Loop
    ?>
    <?php if( $the_query->have_posts() ): ?>
    	<ul>
    	<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    		<li>
    			<a>"><?php the_title(); ?></a>
    		</li>
    	<?php endwhile; ?>
    	</ul>
    <?php endif; ?>
     
    <?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>
    

    This works until I add the ‘value’ to the array, eg ‘value’ => ‘tuesday’, but nothing then appears.

    my check boxes are set up like so:

    monday : Monday
    tuesday : Tuesday etc

Viewing 3 posts - 1 through 3 (of 3 total)