Ok. I use the following code to configure the PageMap for Google CSE. If it’s not too much to ask, would it be possible for you to give me an example of how I could do the same for the WPSOLR inserting a filter in my functions.php?
I don’t have a lot of programming skills. I can only manage with a few things ??
<?php if ( is_single() && has_post_thumbnail() ) {
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail' );
$url = $thumb['0'];
echo "<!--
<PageMap>
<DataObject type='thumbnail'>
<Attribute name='src' value='".$url."'/>
<Attribute name='width' value='112'/>
<Attribute name='height' value='90'/>
</DataObject>
</PageMap>
-->";
} elseif ( is_tax('store') ) {
global $category;
$merchant_logo = $GLOBALS['CORE_THEME']['category_icon_'.$category->term_id];
echo "<!--
<PageMap>
<DataObject type='thumbnail'>
<Attribute name='src' value='".$merchant_logo."'/>
<Attribute name='width' value='112'/>
<Attribute name='height' value='90'/>
</DataObject>
<DataObject type='action'>
<Attribute name='label' value='".$category->name."'/>
<Attribute name='url' value='https://www.mywebsite.com/store/".$category->slug."'/>
<Attribute name='class' value='store'/>
</DataObject>
</PageMap>
-->";
} elseif ( is_singular( 'coupon_type' ) ) {
echo "<!--
<PageMap>
<DataObject type='thumbnail'>
<Attribute name='src' value='".catch_that_image()."'/>
<Attribute name='width' value='112'/>
<Attribute name='height' value='90'/>
</DataObject>
</PageMap>
-->";
} else {
echo "<!--
<PageMap>
<DataObject type='thumbnail'>
<Attribute name='src' value='https://www.mywebsite.com/wp-content/uploads/thumb_posts.png'/>
<Attribute name='width' value='112'/>
<Attribute name='height' value='90'/>
</DataObject>
</PageMap>
-->";
}
?>
-
This reply was modified 7 years, 9 months ago by
moisb.