Slider won’t work with custom query

For this example I used a fake category called “Slider Category” you will need to create that or replace that section of the code. <? $query = new WP_Query( array( ‘category_name’ => ‘Slider Category’ ) ); ?> <div class=”wrapper”> <div class=”list_carousel responsive”> <ul id=”desliza”> <?php while ( $query->have_posts() ) : $query->the_post(); ?> <li> <div class=”feattitle”><a … Read more

array_rand not working correctly?

Getting a single random post would be far more efficient than getting all posts, then plucking a random post from the query. Here’s an updated WP_Query instance using ‘orderby’ => rand: $args = array( ‘orderby’ => ‘rand’, ‘posts_per_page’ => ‘1’, ‘paged’ => $paged, ‘post_type’ => ‘Didyouknows’, // Post type names should never use capital letters, … Read more

and tag not working

the_permalink() and the_post_thumbnail() echo their output. Use the “get_* version of those functions, get_the_permalink() and get_the_post_thumbnail() when concatenating a string to be output. Both the_post_thumbnail() and get_the_post_thumbnail() will echo/return <img> tags so don’t wrap their output in an <img> tag because it’s already taken care of by those functions. The original HTML posted is missing … Read more

WP_Query->request has a limit

Use the posts_per_page parameter in your WP_Query to show a given number of posts. When you don’t provide this parameter, the query takes default value which can be set in backend on https://example.com/wp-admin/options-reading.php.

problem with loop

i think you are missing semicolons on flowing code. i have added semicolons. <div class=”headdark”><h3>Places nearby <?php echo the_title();?> </h3></div> <header class=”thumb-header”><a href=”https://wordpress.stackexchange.com/questions/244872/<?php the_permalink(get_the_ID()); ?>” class=”hover-img”> <div class=”thumb-caption”> <h5 itemprop=”name” class=”thumb-title”><a class=”text-darken” href=”<?php the_permalink() ;?>”><?php the_title();?></a></h5> and you have used {} but in flowing code you use ** : ** in closing logic <?php else … Read more

Query by date from custom field

There is an argument meta_compare. Use it for comparison. $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘matches’, ‘meta_key’ => ‘date’, ‘meta_compare’ => ‘>’, ‘meta_value’ => ‘2016-11-12’, ‘type’ => ‘DATE’ );