WP_Embed_FB::$width = $width_r; echo $link_info; } else { $use_ratio = get_option('wpemfb_video_ratio') == 'true'; echo '<div class="post-link">'; echo $use_ratio ? '<div class="video">' : ''; echo $wp_embed->shortcode(array('src' => $fb_post['link'], 'width' => $width - 20)); echo $use_ratio ? '</div>' : ''; echo $link_info; echo '</div>'; } break; case 'event': WP_Embed_FB::$width = $width - 40; echo $wp_embed->shortcode(array('src' => $fb_post['link'])); WP_Embed_FB::$width = $width; break; case 'photo': ?> <a href="<?php echo "https://www.facebook.com/" . $link[0] . "/posts/" . $link[1]; ?> " rel="nofollow" target="_blank"> <img src="<?php echo $fb_post['full_picture']; ?> " width="100%" height="auto" /><br> </a> <?php echo $link_info; ?>
/** * Shortcode function * [facebook='url' width='600' raw='true' social_plugin='true' posts='2' ] width is optional * @param array $atts [0]=>url ['width']=>embed width ['raw']=>for videos and photos * @return string */ static function shortcode($atts) { if (!empty($atts) && isset($atts[0])) { $clean = trim($atts[0], '='); $juice = str_replace(array('https', 'http', '://facebook.com/', '://m.facebook.com/', '://facebook.com/', '://www.facebook.com/'), '', $clean); if (isset($atts['width'])) { self::$width = $atts['width']; } if (isset($atts['raw'])) { if ($atts['raw'] == 'true') { self::$raw = true; } else { self::$raw = false; } } if (isset($atts['social_plugin'])) { if ($atts['social_plugin'] == 'true') { self::$raw = false; } else { self::$raw = true; } } if (isset($atts['theme'])) { wp_enqueue_style('wpemfb-' . $atts['theme'], WP_Embed_FB_Plugin::get_url() . 'templates/' . $atts['theme'] . '/' . $atts['theme'] . '.css', array(), false); self::$theme = $atts['theme']; } if (isset($atts['posts'])) { self::$num_posts = intval($atts['posts']); } $embed = self::fb_embed(array('https', '://www.facebook.com/', $juice)); return $embed; } return ''; }