I have the following code as i’m trying to make an XML feed for Google shopping from my WordPress shop:
query_posts('post_type=product&showposts=-1&&hide_empty=0');
if (have_posts()) : while (have_posts()) : the_post();
$columns.='<item>';
$columns.='<title>';
$columns.= $post–>post_title;
$columns.='</title>';
$columns.='<link>';
$columns.= 'http://mydomain.co.uk/products/'.$post–>post_name;
$columns.='</link>';
$columns.='<description>';
$columns.=$post–>post_content;
$columns.='</description>';
$columns.='<g:image_link>';
$columns.="http://www.example.com/".$result[$i]['image'];
$columns.='</g:image_link>';
$columns.='<g:price>';
$columns.=$result[$i]['Price'];
$columns.='</g:price>';
$columns.='<g:condition>';
$columns.='new';
$columns.='</g:condition>';
$columns.='<g:id>';
$columns.=$post->ID;;
$columns.='</g:id>';
$columns.='</item>';
endwhile; endif;
But for some reason I can’t get the title, content or postname to work… but the ID will display ok!?
Any suggestions on where i’m going wrong?
Thanks.
Figured it out. Had copied the -> from the internet – seems to have been slightly different characters – retyped them and now it seems fine. Thanks.