Skip to content

Instantly share code, notes, and snippets.

@hunk
Created March 6, 2010 05:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hunk/323514 to your computer and use it in GitHub Desktop.
Save hunk/323514 to your computer and use it in GitHub Desktop.
<?php
//The Query
// exactly than
query_posts('meta_key=start_date&meta_value='.date("Y-m-d"));
// or
// dates less than
// query_posts('meta_key=start_date&meta_compare=<=&meta_value='.date("Y-m-d"));
// or
// date mayor than
// query_posts('meta_key=start_date&meta_compare=>=&meta_value='.date("Y-m-d"));
//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post();
echo the_title();
echo "<br />";
endwhile; else:
endif;
//Reset Query
wp_reset_query();
?>
@e1e1e1
Copy link

e1e1e1 commented Nov 11, 2011

Hi Hunk
Could you help me.
Im using magic field on my custom wordpress template

            <?php while($wp_query ->have_posts()) : $wp_query ->the_post();?>
    
    <li class="boxgrid slidedown">
        <div class="cover">
            <div class="datewrap">
                <div class="closedt">
                    <p>CLOSES<br/><?php echo get('end');?></p></div>
                <div class="country"><p>OPEN FOR: <br/>
                        <?php $value = get('NZ');
                        if($value){echo "NZ";
                        };?> 
                        <?php $value2 = get('AUS');
                        if($value2){echo "AUS";
                        };?></p>
                </div> 
            </div><!--/datewrap  -->
            <div class="thumb">
                <img src="<?php echo get('image');?>" alt="<?php the_title(); ?>"/></div>
            <div class="mlisthead">
                <h1><?php the_title(); ?></h1></div>
        </div>
        
        <div class="excerpt">
            <p><?php $excerpt = get_the_excerpt();
                    echo string_limit_words($excerpt,15);?><br/></p>
            <div class="enterbtnA" >
            <a href="<?php the_permalink() ?>" >MORE</a></div>
        </div>
    </li>
    
    <?php endwhile; ?>
    <div id="paginate"><?php wp_paginate();?></div>
    

I try filter my qurey base on magic field checklist, but doesnt work. could you point me which part i missed

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment