*

Ajit Sahane

  • ****
  • 147 posts
  • https://bestclassifiedsusa.com
Local Business Schema for category pages
« on: April 01, 2023, 02:06:55 PM »
xyz.com/for-sale -  now for-sale category -  10 ads

here loop-single.php called in search.php and showing items with img & other data.

So, I want to generate local business schema using those items shown.

If we shown 10+  free items & 4-5 premium items etc total items, then

want either premium ads or either free section ads or combine both section ads with limit. if limit set 10 then 1st all premium & then free ads counted and top 10 ads data used in local business schema inside.

So, basically  want this schema type json-ld format with selected categories only. 

MB team can make special plugin for this function. Its must required for SEO.

I try to make this schema, but search page - item data can't fetch with loop.

<div class="products <?php echo $view; ?>">
          <?php
            $c = 1;
            while(osc_has_items()) {
              eps_draw_item($c, false, eps_param('def_design'));

              if($c == 3 && osc_count_items() > 3) {
                echo eps_banner('search_middle');
              }

              $c++;
            }
          ?>
        </div>

Here want these inside values in json-ld schema format - how to get these values in c++ loop format with limit 10 etc.  ..? like,

<script type="application/ld+json">
{
  "@context": "https://schema.org/",
  "@type": "LocalBusiness",
  "name": "<?php echo osc_item_title(); ?>",
  <?php if($image_url <> '') { ?>"image": "<?php echo osc_esc_html($image_url); ?>",<?php echo PHP_EOL; } ?>
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "<?php echo osc_esc_html(osc_item_address()); ?>",
    "addresslocality": "<?php echo osc_item_city_area() .' '.osc_item_city(); ?>",
    "postalCode": "<?php echo osc_esc_html(osc_item_zip()); ?>",
    "addressCountry": "IN"
  },
  "url": "<?php echo osc_item_url(); ?>"
}
</script>

So, anybody can try this...? OR mb team can guide more in this...?

Long awaited question, but no reply.
« Last Edit: April 20, 2023, 08:51:24 AM by Ajit Sahane »