How to pick “full/thumbnail” images in the loop?

Try just using the traditional $i iterator (untested) but I can’t see why this wouldn’t work.. <?php $i = 0; while ( have_posts() ) : the_post(); $i++; if ( $i == 1 ): ?> <!– First Post –> <div id=”post”> <a class=”post_image” href=”https://wordpress.stackexchange.com/questions/165568/<?php the_permalink(); ?>” title=”<?php the_title(); ?>”> <?php if ( has_post_thumbnail() ): ?> <?php … Read more

Integrating WordPress with Your Website

If I understand your needs correctly, you would like to have your /blog page and post items aggregated and driven by WordPress without exposing the user to anything WordPress. To solve the problem with “wordpress” being in the url, you should actually be putting the entire contents of the WordPress install into the website.tld/blog directory. … Read more

how can i order the category by date

When the instance of WP_Query is not a variable on the PHP file you are working on it tends to be the “main” query and to edit this instance of the WP_Query you will need to Hook to the pre_get_posts action and change what you need there. Here is an Exemple: <?php add_action( ‘pre_get_posts’, ‘q166401_pre_get_posts’, … Read more

Get posts with no tags?

I’m not in the position to code right now, but here is an idea A thousand posts is quite a lot, but it is even more if you are retrieving all posts from the db in one go. What if you have ten thousand posts, of which only ten or twenty is not tagged after … Read more

Price comparison table based on Custom Post Type?

I suggest just making a new Post Type with the default WordPress register_post_type(). function create_my_post_type() { $labels = array( ‘name’ => __( ‘Providers pricing’, ‘myplugin_namespace’ ), ‘singular_name’ => __( ‘Provider pricing’, ‘myplugin_namespace’ ), ‘menu_name’ => __( ‘Provider Pricing’, ‘myplugin_namespace’ ), ); $args = array( ‘labels’ => $labels, ‘public’ => true, ‘description’ => __( ‘Pricing stuff … Read more

Accessing Post ID Within Loop

The problem probably comes from whenever a $post has no terms set. You need to set $brand = array() outside your IF statement, add it just under get_the_terms(). At that point it also wouldn’t hurt to wrap your switch statement in a if( ! empty( $brand ) ) { Another problem I see with this … Read more

Frontpage pagination by week

Use the page number to calculate a new date to get the week to fetch: $page = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $date_to_fetch = time() – ( 604800 * ( $page – 1 ) ) ); $query_string = array( ‘post_type’ => ‘post’, ‘date_query’ => array( array( ‘year’ => date( … Read more

Query all post types but limit to parents

In your functions.php you can create a function that will hook into the pre_get_posts hook. Something like (just an example): function alter_query($query){ $query->set(‘post_parent’, 0); } add_action( ‘pre_get_posts’, ‘alter_query’ ); There you can alter the main query. That way while(have_posts()) : the_post(); will still just normally work. (You should check if you are altering the right … Read more