Get excerpt using get_the_excerpt outside a loop

I have a code that call get_the_title() and it works, but get_the_excerpt() return empty. How can i make it work? This code is inside a plugin called “WP Facebook Open Graph protocol”. Here’s the part i want to change: if (is_singular(‘post’)) { if (has_excerpt($post->ID)) { echo “\t<meta property=’og:description’ content=””.esc_attr(strip_tags(get_the_excerpt($post->ID))).”” />\n”; }else{ echo “\t<meta property=’og:description’ content=””. … Read more

Pagination not working with custom loop

I’ve got a custom loop that I’m using to display some Real Estate listings that will be available within 60 days. I’m calling it with the following function: <?php $sixtydays = date(‘Y/m/d’, strtotime(‘+60 days’)); $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $query = new PostsOrderedByMetaQuery(array( ‘post_type’ => array(‘post’, ‘real-estate’), ‘meta_key’ => ‘Time Available’, ‘meta_compare’ => … Read more

Counting the posts of a custom WordPress loop (WP_Query)?

I tried tplacing this: <?php $count = count($custom_posts); ?> <h2><?php echo $count; ?></h2> at the end of the loop: <?php if ( bbp_get_forum_title() == ‘Test Forum 1’ ) : ?> <?php $custom_posts = new WP_Query(); ?> <?php $custom_posts->query(‘post_type=blocks&location=Business and Finance&order=DESC’); ?> <?php while ($custom_posts->have_posts()) : $custom_posts->the_post(); ?> <div class=”ad”> <?php the_content(); ?> </div> <?php $count … Read more