/** * Generate a HTML div element with data-* attributes to be converted into a Facebook embedded post * * @since 1.5 * * @param array $attributes shortcode attributes. overrides site options for specific button attributes * @param string $content shortcode content. no effect * @return string Follow Button div HTML or empty string if minimum requirements not met */ public static function embedded_post($attributes, $content = null) { global $content_width; $options = shortcode_atts(array('href' => '', 'width' => 0, 'show_border' => true), $attributes, 'facebook_embedded_post'); $options['href'] = trim($options['href']); if (!$options['href']) { return ''; } if (!class_exists('Facebook_Embedded_Post')) { require_once dirname(__FILE__) . '/class-facebook-embedded-post.php'; } $options['width'] = absint($options['width']); if (!Facebook_Embedded_Post::isValidWidth($options['width'])) { unset($options['width']); if (isset($content_width)) { $width = absint($content_width); if (Facebook_Embedded_Post::isValidWidth($width)) { $options['width'] = $width; } } } $embed = Facebook_Embedded_Post::fromArray($options); if (!$embed) { return ''; } return $embed->asHTML(array('class' => array('fb-social-plugin'))); }
/** * Generate a HTML div element with data-* attributes to be converted into a Facebook embedded post * * @since 1.5 * * @param array $attributes shortcode attributes. overrides site options for specific button attributes * @param string $content shortcode content. no effect * @return string Follow Button div HTML or empty string if minimum requirements not met */ public static function embedded_post($attributes, $content = null) { $options = shortcode_atts(array('href' => '', 'show_border' => true), $attributes, 'facebook_embed_post'); $options['href'] = trim($options['href']); if (!$options['href']) { return ''; } if (!class_exists('Facebook_Embedded_Post')) { require_once dirname(__FILE__) . '/class-facebook-embedded-post.php'; } $embed = Facebook_Embedded_Post::fromArray($options); if (!$embed) { return ''; } return $embed->asHTML(array('class' => array('fb-social-plugin'))); }