0

Wordpress ショップから Google ショッピング用の XML フィードを作成しようとしているときに、次のコードがあります。

query_posts('post_type=product&showposts=-1&&hide_empty=0');
if (have_posts()) : while (have_posts()) : the_post();


$columns.='<item>';

$columns.='<title>';
$columns.= $post–&gt;post_title;
$columns.='</title>';

$columns.='<link>';
$columns.= 'http://mydomain.co.uk/products/'.$post–&gt;post_name;
$columns.='</link>';

$columns.='<description>';
$columns.=$post–&gt;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;

しかし、なぜかタイトルも内容もポストネームもうまく動かない…でもIDはちゃんと表示される!?

私が間違っている場所に関する提案はありますか?

ありがとう。

4

3 に答える 3

1

変化する

$columns.= $post–&gt;post_title;

$columns.= get_the_title();

コーデックス: get_the_title()

于 2012-12-12T11:14:12.040 に答える
0

理解した。インターネットから -> をコピーしていた - 少し違う文字だったようだ - 再入力したところ、問題ないようだ。ありがとう。

于 2012-12-12T11:10:32.220 に答える
0

私のWPは錆びていますが、変更するとどうなりますか

$columns.= $post–&gt;post_title;

$columns.= the_title();
于 2012-12-12T11:00:31.037 に答える