Is file_exists() compatible with timthumb.php? [closed]

The file_exists() function is a built in php function and should work everywhere. But with the way you’re doing it, is wrong. You cannot use a query string within a php file to check if the file exists. Just because its a valid link, doesn’t mean the file_exists(). There is no file on your server … Read more

$post in wp_query?

$query = new WP_Query( $args ); while( $query->have_posts() ) { // this fills in the $post global with the next post from the query $query->the_post(); // we’re now ina classic wordpress loop, and can use all the usual stuff the_title(); the_content(); echo $post->post_content; } // lets clean up after ourself so else we might mess … Read more

Open Graph in Index Loop

Short answer: you can’t do that, that’s not what OpenGraph data is, does, or how it works. Long answer: OpenGraph applies to the single post pages only, realistically. When you’re putting a like button (for example) onto each post on a archive page, the like button is going to point to the permalink of the … Read more

Defining ‘last’ class on foreach blog posts

Something like this should work for you. $args = array( ‘numberposts’ => 3 ); $lastposts = get_posts( $args ); $count = 1; foreach($lastposts as $post) : setup_postdata($post); ?> <div id=”blog” class=”<?php if ($count == 3) : ?>last<?php endif; ?>”> <div class=”blog-header”><a href=”https://wordpress.stackexchange.com/questions/34591/<?php the_permalink(); ?>”> <?php the_title(); ?> </a> <div class=”date”> <?php the_date(); ?> </div> </div> … Read more

Custom Post Type Query W/Category Dropdown

You seem to be using 2 separate queries there, the first (query_posts) won’t do anything, and the second is the query that will be used. Have you tried: $args=array( ‘category__in’ => $cats, ‘post_type’ => ‘profiles’, ‘posts_per_page’ => 10, ‘order’=> ‘ASC’, ‘orderby’ => ‘title’ ); $loop= null; $loop = new WP_Query($args); Try that instead of: query_posts(array( … Read more

Magazine style frontpage with multiple categories/loops and no duplicate posts

I wrote a class specifically for passing data between widgets classes using static variables and it will work for your use case as well. Grab the class here. The way you would use this is as follows for each custom loop: $exclude_ids = IntermediaryData::get(); //Retrieve previous exclude IDs $args[‘post__not_in’] = $exclude_ids; //new WP_Query($args); Custom loop … Read more