PHP code example of inc2734 / wp-ogp

1. Go to this page and download the library: Download inc2734/wp-ogp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

inc2734 / wp-ogp example snippets



add_action(
	'wp_head',
	function() {
		$ogp = new \Inc2734\WP_OGP\Bootsrap();
		

/**
 * Customize og:title
 *
 * @param string $title
 * @return string
 */
add_filter(
	'inc2734_wp_ogp_title',
	function( $title ) {
		return $title;
	}
);

/**
 * Customize og:type
 *
 * @param string $type
 * @return string
 */
add_filter(
	'inc2734_wp_ogp_type',
	function( $type ) {
		return $type;
	}
);

/**
 * Customize og:url
 *
 * @param string $url
 * @return string
 */
add_filter(
	'inc2734_wp_ogp_url',
	function( $url ) {
		return $url;
	}
);

/**
 * Customize og:image
 *
 * @param string $image
 * @return string
 */
add_filter(
	'inc2734_wp_ogp_image',
	function( $image ) {
		return $image;
	}
);

/**
 * Customize og:description
 *
 * @param string $description
 * @return string
 */
add_filter(
	'inc2734_wp_ogp_description',
	function( $description ) {
		return $description;
	}
);

/**
 * Customize og:locale
 *
 * @param string $locale
 * @return string
 */
add_filter(
	'inc2734_wp_ogp_locale',
	function( locale ) {
		return $locale;
	}
);

/**
 * Customize fb:app_id
 *
 * @param string $app_id
 * @return string
 */
add_filter(
	'inc2734_wp_ogp_app_id',
	function( $app_id ) {
		return $app_id;
	}
);