Share images on facebook from osclass

Is important to use the best practice in sharing the information on Facebook to have control over how your content appears on Facebook. Open Graph Markup will ensure that in a shared post you will have the content that you want to share and no other information or images from that page.

If you don't include this markup on your pages Facebook Crawlers will decide what information will include on a shared post and in most cases, this will be wrong, the post will have incorrect data or some other content from that page.

How to use Facebook Open Graph Markup?

Add this markup in the head area from your theme:

<?php if(osc_is_ad_page()){ ?>
<meta property="og:title" content="<?php echo osc_highlight(strip_tags(osc_item_title()), 100); ?>"/>
<meta property="og:url" content="<?php echo osc_item_url(); ?>"/>
<?php if (osc_count_item_resources() > 0) { ?>
 <meta property="og:image" content="<?php echo osc_resource_thumbnail_url(); ?>"/>
<?php } else { ?>
 <meta property="og:image" content="<?php echo osc_current_web_theme_url('images/no_image.gif'); ?>"/>
<?php } ?>
<meta property="og:site_name" content="<?php echo osc_esc_html(meta_title()); ?>"/>
<meta property="og:description" content="<?php echo osc_highlight(strip_tags(osc_item_description()), 100); ?>"/>
<?php } ?>

You have some properties that need to be filled and we use PHP osclass functions to generate the content for these properties.

You will get this result:

<meta property="og:title" content="CBK Osclass Premium Theme"/>
<meta property="og:url" content=""/>
<meta property="og:image" content=""/>
<meta property="og:site_name" content="CBK Osclass Premium Theme  - Osclass Market"/>
<meta property="og:description" content="Cbk is a responsive theme for osclass based on Bootstrap 4 framework with multiple options and beaut..."/>

And this is how you share information on Facebook in a correct way.  For more information, you can see facebook best practice guide.



Subscribe to get the latest listings, updates and special offers delivered directly in your inbox.