I'm new to php and was assigned some code to fix within a Wordpress theme, but I cannot figure it out for anything. The code is for the home page of a custom theme and it is supposed to pull the most recent blog posts and put them in a 3x2 grid at the top of the page.
Here's the page in question
and here's the code from the index.php file (I believe that's where the problem lies)
<?php get_header(); ?>
<?php global $woo_options; ?>
<?php if ( $woo_options['woo_featured_disable'] <> "true" ) include( TEMPLATEPATH . '/includes/featured.php'); ?>
<?php
$t = array();
$t[2] = "A";
$t[5] = "B";
query_posts('post_type=infobox&order=ASC&posts_per_page=20&meta_value=false');
if (have_posts()) :
$a = array(0,1,3,4); $i = 0;
while (have_posts()) : the_post();
$m = "";
$m .= "<div class=\"bskhp_t\" style='font-family:arial;font-size:12px'>";
$m .= "<a href=\"".get_post_meta($post->ID, 'mini_readmore', $single = true)."\"><img src=\"".get_post_meta($post->ID, 'mini', $single = true)."\" alt=\"\" class=\"home-icon\"></a>";
$m .= "<div class=\"bskhp_f\">";
$m .= "<h3><a href=\"".get_post_meta($post->ID, 'mini_readmore', $single = true)."\">".get_the_title()."</a></h3>";
$m .= "<p>".get_post_meta($post->ID, 'mini_excerpt', true)."</p>";
$m .= "<a style='font-family:arial;font-size:13px;text-transform: uppercase' href=\"".get_post_meta($post->ID, 'mini_readmore', $single = true)."\" class=\"btn\">";
$m .= "<span>Read More</span></a>";
$m .= "</div>";
$m .= "</div>";
$t[$a[$i++]] = $m;
endwhile;
endif;
$t[2] = $t[0];
$t[3] = $t[0];
$t[4] = $t[0];
$t[5] = $t[0];
This code for some reason will not pull the latest blog posts and put them in the 3x2 grid, except for the first two items, and I have no idea why. I believe the problem is within the get_post_meta function, but my knowledge is too sparse to debug it.
Can anyone help? I would be very gracious :)
query_posts
to anew WP_QUERY
thenvar_dump()
the query. Do you see the posts you expect?