Google Merchantにfeed登録したくて、
以下のブログと、
Welcartの商品をGoogleショッピング(Google merchant center グーグル マーチャントセンター)に登録する方法 | T0M0ブログ
加えて以下のブログを、
WelcartとGoogle ショッピングの連動 |リフログ
参考にしながら、悪戦苦闘。
結局、手打ちが多くなってしまったけど、なんとかエラーが消えた。
疲れた~
以下は、作成したfeed-rss2.php。
<?php
/**
* RSS2 Feed Template for displaying RSS2 Posts feed.
*
* @package WordPress
*/
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
$more = 1;
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
<rss version='2.0' xmlns:g='http://base.google.com/ns/1.0'>
<channel>
<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
<description><?php bloginfo_rss("description") ?></description>
<link><?php echo get_option('home'); ?></link>
<?php do_action('rss2_head'); ?>
<?php while( have_posts()) : the_post(); usces_the_item();?>
<item>
<title><?php the_title(); ?></title>
<g:brand>■■■■■XX工房■■■■</g:brand>
<g:condition>new</g:condition>
<description>■■■■■■■■■■■■■■■■■■■■■</description>
<g:shipping>
<g:country>JP</g:country>
<g:price>540 JPY</g:price>
</g:shipping>
<g:id><?php the_ID(); ?></g:id>
<g:availability><?php usces_have_skus(); ?><?php if(usces_the_itemZaiko('return') =='在庫有り'){echo 'in stock';}else{$zaiko='out of stock'; echo $zaiko; } ?></g:availability>
<g:image_link>http://■■■■.com/gfc/wp-content/uploads/2015/10/mix.jpg</g:image_link> <link><?php the_permalink_rss() ?></link> <g:mpn><?php usces_the_itemCode(); ?></g:mpn> <g:price><?php usces_the_firstPrice(); ?></g:price> <g:google_product_category>食品・飲料 > 食品 > パン・焼き菓子 > ■■■■</g:google_product_category> <g:product_type>食品・飲料 > 食品 > パン・焼き菓子 > ■■■■</g:product_type> <?php do_action('rss2_item'); ?> </item> <?php endwhile; ?> </channel> </rss>