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’.
That’s a really inefficient way to do it. Just use the $count variable you declared at the top, without any query_posts(): $count = 0; while ( have_posts() ) : the_post(); if ( $count < 1 ) { // first post } elseif ( $count <= 4 ) { // next 4 posts } else { … Read more
I’m assuming you’re talking about this piece of maintenance code right here: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-admin/includes/post.php#L419 Indeed, the code calls on lower level functionality of $wpdb, which doesn’t contain too many hooks, only one in fact, query. http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/wp-db.php#L1061 So, in order to return an empty result set you’ll have to come up with a no-operation type of query, … Read more
Don’t you mean this query: “SELECT post_id FROM like WHERE user_id = %d ORDER BY id DESC” where we assume that the id column is unique and increase with each like.
You could use the following and it should do exactly what you want by checking the value of $loop->current_post. <?php $loop = new WP_Query( array( ‘post_type’ => ‘work’,’posts_per_page’ => ‘-1’ ) ); ?> <ul id=”carousel”> <li> <ul class=”inner-items”> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php if( $loop->current_post && !($loop->current_post % 6) ) : … Read more
It’s down to how you’re using get_term_link() – since you’re passing a slug, WordPress can’t locate the term in it’s internal cache (terms are indexed by ID), so it grabs it directly from the db. To use the cache, pass the ID. Better yet, pass just the object: get_term_link( $category ); // No need for … Read more
How to get user by display_name with WP_User_Query
Each HTTP request is a new one so you will need to save the data to the database. You can’t just “pass” the data from the front to the back end. function get_queries_wpse_143544() { $dbq = get_num_queries(); update_option(‘page_queries’,$dbq); } add_action(‘wp_footer’, ‘get_queries_wpse_143544’, 999); Then retrieve the data with get_option.
You could set this in your theme using conditionals. Create a separate menu for each category using the WordPress menu feature (Appearances > Menus). Then in your theme, where you want the menu to display, determine which menu to display using the is_category(‘category-slug’) and/or in_category(‘category-slug’) conditionals and the wp_nav_menu function (http://codex.wordpress.org/Function_Reference/wp_nav_menu). For instance: <?php if(is_category(‘first-category’) … Read more
The difference is, in “plugin_part1-fixed.php” you wouldn’t lose existing args. Consider the url: https://www.example.com/page/?foo=bar Your code in “plugin_part1.php” would output <a href=”https://www.example.com/page/?custom_var=column”>text</a> Note, the existing arg “foo” has been lost, the code in “plugin_part1-fixed.php” would output: <a href=”https://www.example.com/page/?foo=bar&custom_var=column”>text</a> Note, the existing arg “foo” is still present and your arg has been appended. Since you don’t … Read more