Comparing timestamps in meta query doesn’t work
This is the magic: with timestamps, insteed of ‘type’ => ‘DATE’ must be used ‘type’ => ‘NUMERIC’.
This is the magic: with timestamps, insteed of ‘type’ => ‘DATE’ must be used ‘type’ => ‘NUMERIC’.
Why not do it via URL parameter? You said you can’t because Codex told you not to. But if you want to anyway, you could use a GET parameter: // http://example.com/page-slug/?direction=DESC if($_GET[‘direction’] == ‘DESC’){ $order=”DESC”; } else { $order=”ASC”; } $args = array( … … ‘order’ => $order, );
Use it like this : <div id=”page” class=”hfeed site”> <?php do_action( ‘before’ ); ?> <?php $page_id = ( ‘page’ == get_option( ‘show_on_front’ ) ? get_option( ‘page_for_posts’ ) : get_the_ID ); $banner = get_post_meta( $page_id, ‘banner’, true ); if (is_front_page() || $banner == ”) { ?> <header id=”masthead” class=”site-header” role=”banner”> <?php } else { ?> <header … Read more
<div class=”col-xs-12 col-sm-12 col-md-8 col-lg-8 left_column”> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h1> <?php the_title();?> </h1> <?php $post_meta = get_post_meta(get_the_ID()); foreach($post_meta as $key=>$value) { echo “<strong>”.$key.”</strong>”.” => “; foreach($value as $nameAr=>$valueAr) { echo “<br /> ”; echo $nameAr.” => “.$valueAr; } echo “<br >”; } the_content(); endwhile; endif; ?> </div>
May this code help $args = array( ‘cat’ => ‘Category id’ ‘post_type’ => ‘post type’, ‘meta_key’ => ‘enter your metakey’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘meta_query’ => array( array( ‘key’ => ‘age’, ‘value’ => array(min price, max price), ‘compare’ => ‘IN’, ) ) ); $query = new WP_Query($args); $query will contain an Array of … Read more
First, you don’t need the <form> tags; meta boxes are already rendered inside the post edit form. Second, if a checkbox is not checked it is not sent, so isset( $_POST[‘checkbox_name’] ) return false and the custom field that stores the value of the checkbox is not update correctly. I’ve tested this code with standard … Read more
Using pre_get_posts may work. Can you try something similar to the following and let me know if it meets your needs: function search_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_search) { $query->set(‘post_type’, array( ‘post’, ‘movie’ ) ); //Should do some sanitation on $GET too if(isset($_GET[‘author’])){ //Change to your field dropdown name $query->set(‘meta_key’, … Read more
You need to implement a hook for pre_get_posts filter, in which you can set what you need. Pay attention that you should change only search query, so you have to check if is_search() method returns true. The hook should look like this: add_filter( ‘pre_get_posts’, ‘wpse8170_pre_get_posts’ ); function wpse8170_pre_get_posts( WP_Query $query ) { if ( $query->is_search() … Read more
The visibility of custom fields on the post edit screen is controlled on the post edit page. There’s a button called “Screen Options” towards the top of the screen. Clicking that button will display all of the available boxes and panels for the edit page. If custom fields is not visible here, then either your … Read more
Your question literally doesn’t quite sound like “combining” loops, that’s usually different thing in WP terminology. Following it literally you already know the part that outputs artist name you want — the_field(‘artist_name’). What probably confuses it in first context is that it’s not really a normal WP loop. Note how that call doesn’t specify which … Read more