Filter query_posts by tag slug on “Tag Archive” page (when tag is 2 or more words)

I’m using the following to bring up a tag archive page: <?php query_posts( “tag=”. ” . single_tag_title( ”, false ) . ” ); ?> This works perfectly for all tags of one word only, but any tags of more than one word (eg: “tag one”, slug: “tag-one”) do not display. Is it possible to query_posts … Read more

post_status => publish not working

I have a front end form that let users submit a post. This is how i store the data when a post is submitted : if ( isset( $_POST[‘submitted’] )) { $post_information = array( ‘post_title’ => wp_strip_all_tags( $_POST[‘postTitle’] ), ‘post_content’ => $_POST[‘postContent’], ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’ ); $new_post = wp_insert_post( $post_information ); The … Read more

posts_per_page => 1 shows 2 posts

I am trying to add a button to take the viewer to a random post. Below’s the code I am using:- <?php query_posts(array(‘orderby’ => ‘rand’, ‘posts_per_page’ => 1)); if (have_posts()) : while (have_posts()) : the_post(); ?> <div class=”post-lot”> <a href=”<?php the_permalink() ?>”>Yes, Robo! Take me there.</a> </div> <?php endwhile; endif; ?> But, it keeps showing … Read more

Query posts by custom post type and custom taxonomy

I am writing a custom loop query to filter through a custom post type and custom taxonomy. I have replaced any variables with static values for the purpose of showing you what result I want. $args = array( ‘manufacturer’ => ‘Keystone’, ‘post_type’ => ‘rv’, ‘category_name’ => ‘new’, ‘rvtype’ => ‘fifth-wheel’ ); $loop = new WP_Query($args); … Read more

meta query not showing any results?

I’m trying to show result for a custom field that is not empty on a custom post type but getting no results? <?php if (have_posts()) : $args = array( ‘post_type’ => ‘programmes’, ‘meta_query’ => array( ‘key’ => ‘linktovideocatchup’, ‘value’ => ”, ‘compare’ => ‘NOT LIKE’), //’caller_get_posts’ => 1, ); ?> <?php query_posts( $args ); ?> … Read more

Query posts without a specific ID

How would we query posts as long as the post does not equal the ID 2047? Here is the current query. <?php $args1 = array( ‘post_type’ => ‘options’, ‘tag_slug__and’ => array( $triplevel, $divingtrip, ‘accommodation’ ), ‘posts_per_page’ => -1, ‘offset’ => 1, ); query_posts( $args1 ); while (have_posts()) : the_post(); ?> I tried this… query_posts( $args1 … Read more

Post Title displaying but not in the wrapped HTML I need

I have a custom query to get the post title, permalink, and featured image. However the Post title is displaying but not in the container I want it in. here is the query <ul class=”updatelist”> <?php $portquery = new WP_Query(); $portquery->query(array(‘cat’ => 3, ‘posts_per_page’ => 2)); while ($portquery->have_posts()) : $portquery->the_post(); echo “<li class=”firstupdate”>”; ?> <?php … Read more