first commit
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* The admin-specific functionality of the module.
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Powerkit
|
||||
* @subpackage Modules/Admin
|
||||
*/
|
||||
|
||||
/**
|
||||
* The admin-specific functionality of the module.
|
||||
*/
|
||||
class Powerkit_Facebook_Admin extends Powerkit_Module_Admin {
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
public function initialize() {
|
||||
add_action( 'admin_init', array( $this, 'register_settings_section' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register admin page
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function register_settings_section() {
|
||||
|
||||
add_settings_section( 'powerkit_facebook_settings', sprintf( '<span id="%s">%s</span>', powerkit_get_page_slug( $this->slug ), esc_html__( 'Facebook Comments', 'powerkit' ) ), array( $this, 'powerkit_facebook_settings_callback' ), 'discussion' );
|
||||
|
||||
add_settings_field( 'powerkit_facebook_enable_comments', esc_html__( 'Enable Facebook Comments', 'powerkit' ), array( $this, 'powerkit_facebook_enable_comments_callback' ), 'discussion', 'powerkit_facebook_settings' );
|
||||
add_settings_field( 'powerkit_facebook_number_comments', esc_html__( 'Number of Comments', 'powerkit' ), array( $this, 'powerkit_facebook_number_comments_callback' ), 'discussion', 'powerkit_facebook_settings' );
|
||||
|
||||
register_setting( 'discussion', 'powerkit_facebook_enable_comments' );
|
||||
register_setting( 'discussion', 'powerkit_facebook_number_comments_callback' );
|
||||
|
||||
$locations = apply_filters( 'powerkit_facebook_comments_location', array() );
|
||||
|
||||
// If locations > 1.
|
||||
if ( count( (array) $locations ) > 1 ) {
|
||||
add_settings_field( 'powerkit_facebook_location', esc_html__( 'Location', 'powerkit' ), array( $this, 'powerkit_facebook_location_callback' ), 'discussion', 'powerkit_facebook_settings' );
|
||||
register_setting( 'discussion', 'powerkit_facebook_location' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Section Description.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function powerkit_facebook_settings_callback() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Field | Enable Facebook Comments.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function powerkit_facebook_enable_comments_callback() {
|
||||
?>
|
||||
<input class="regular-text" id="powerkit_facebook_enable_comments" name="powerkit_facebook_enable_comments" type="checkbox" value="true" <?php checked( (bool) get_option( 'powerkit_facebook_enable_comments', false ) ); ?>>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Field | Number of Comments.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function powerkit_facebook_number_comments_callback() {
|
||||
?>
|
||||
<input class="small-text" id="powerkit_facebook_number_comments" name="powerkit_facebook_number_comments" type="number" value="<?php echo esc_attr( get_option( 'powerkit_facebook_number_comments', 10 ) ); ?>" /> <?php esc_html_e( 'items', 'powerkit' ); ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Field | Location.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function powerkit_facebook_location_callback() {
|
||||
$locations = apply_filters( 'powerkit_facebook_comments_location', array() );
|
||||
?>
|
||||
<select class="regular-text" name="powerkit_facebook_location" id="powerkit_facebook_location">
|
||||
<?php
|
||||
if ( $locations ) {
|
||||
foreach ( $locations as $key => $item ) {
|
||||
?>
|
||||
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( get_option( 'powerkit_facebook_location' ), $key ); ?>><?php echo esc_attr( $item['name'] ); ?></option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Facebook Integration
|
||||
*
|
||||
* @package Powerkit
|
||||
* @subpackage Modules
|
||||
*/
|
||||
|
||||
if ( class_exists( 'Powerkit_Module' ) ) {
|
||||
/**
|
||||
* Init module
|
||||
*/
|
||||
class Powerkit_Facebook extends Powerkit_Module {
|
||||
|
||||
/**
|
||||
* Register module
|
||||
*/
|
||||
public function register() {
|
||||
$this->name = esc_html__( 'Facebook Integration', 'powerkit' );
|
||||
$this->desc = esc_html__( 'Display your Facebook Fanpage widget in your sidebar or post content via a shortcode. Enable Facebook comments next to or instead of WordPress comments.', 'powerkit' );
|
||||
$this->slug = 'facebook_integration';
|
||||
$this->type = 'default';
|
||||
$this->category = 'social';
|
||||
$this->priority = 30;
|
||||
$this->public = true;
|
||||
$this->enabled = true;
|
||||
$this->load_extensions = array(
|
||||
'connect',
|
||||
);
|
||||
$this->links = array(
|
||||
array(
|
||||
'name' => esc_html__( 'Go to settings', 'powerkit' ),
|
||||
'url' => admin_url( sprintf( 'options-discussion.php#%s', powerkit_get_page_slug( $this->slug ) ) ),
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'View documentation', 'powerkit' ),
|
||||
'url' => powerkit_get_setting( 'documentation' ) . '/social-integrations/facebook-integration/',
|
||||
'target' => '_blank',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize module
|
||||
*/
|
||||
public function initialize() {
|
||||
|
||||
/* Load the required dependencies for this module */
|
||||
|
||||
// Helpers Functions for the module.
|
||||
require_once dirname( __FILE__ ) . '/helpers/helper-powerkit-facebook.php';
|
||||
|
||||
// The classes responsible for defining all actions.
|
||||
require_once dirname( __FILE__ ) . '/public/class-powerkit-facebook-public.php';
|
||||
require_once dirname( __FILE__ ) . '/public/class-powerkit-facebook-fanpage-widget.php';
|
||||
require_once dirname( __FILE__ ) . '/public/class-powerkit-facebook-fanpage-shortcode.php';
|
||||
|
||||
// Gutenberg blocks.
|
||||
if ( function_exists( 'register_block_type' ) ) {
|
||||
require_once dirname( __FILE__ ) . '/public/class-powerkit-facebook-fanpage-block.php';
|
||||
}
|
||||
|
||||
// Admin and public area.
|
||||
require_once dirname( __FILE__ ) . '/admin/class-powerkit-facebook-admin.php';
|
||||
require_once dirname( __FILE__ ) . '/public/class-powerkit-facebook-public.php';
|
||||
|
||||
new Powerkit_Facebook_Admin( $this->slug );
|
||||
new Powerkit_Facebook_Public( $this->slug );
|
||||
}
|
||||
}
|
||||
|
||||
new Powerkit_Facebook();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Helpers Facebook
|
||||
*
|
||||
* @package Powerkit
|
||||
* @subpackage Modules/Helper
|
||||
*/
|
||||
|
||||
/**
|
||||
* Facebook load sdk.
|
||||
*/
|
||||
function powerkit_facebook_load_sdk() {
|
||||
?>
|
||||
<div id="fb-root"></div>
|
||||
<script>( function( d, s, id ) {
|
||||
var js, fjs = d.getElementsByTagName( s )[0];
|
||||
if ( d.getElementById( id ) ) return;
|
||||
js = d.createElement( s ); js.id = id;
|
||||
js.src = "//connect.facebook.net/<?php echo esc_html( powerkit_get_locale() ); ?>/sdk.js#xfbml=1&version=v2.5&appId=<?php echo esc_html( powerkit_connect( 'facebook_app_id' ) ); ?>";
|
||||
fjs.parentNode.insertBefore( js, fjs );
|
||||
}( document, 'script', 'facebook-jssdk' ) );</script>
|
||||
<?php
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){var r;
|
||||
/*!
|
||||
Copyright (c) 2018 Jed Watson.
|
||||
Licensed under the MIT License (MIT), see
|
||||
http://jedwatson.github.io/classnames
|
||||
*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r)){if(r.length){var i=o.apply(null,r);i&&e.push(i)}}else if("object"===a)if(r.toString===Object.prototype.toString)for(var u in r)n.call(r,u)&&r[u]&&e.push(u);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t,n){!function(e){"use strict";function t(e,t,n,r){var o,a=!1,i=0;function u(){o&&clearTimeout(o)}function f(){for(var f=arguments.length,c=new Array(f),l=0;l<f;l++)c[l]=arguments[l];var s=this,p=Date.now()-i;function b(){i=Date.now(),n.apply(s,c)}function d(){o=void 0}a||(r&&!o&&b(),u(),void 0===r&&p>e?b():!0!==t&&(o=setTimeout(r?d:b,void 0===r?e-p:e)))}return"boolean"!=typeof t&&(r=n,n=t,t=void 0),f.cancel=function(){u(),a=!0},f}e.debounce=function(e,n,r){return void 0===r?t(e,n,!1):t(e,r,!1!==n)},e.throttle=t,Object.defineProperty(e,"__esModule",{value:!0})}(t)},function(e,t,n){e.exports=n(6)},,,,function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),a=n(1);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?p(e):t}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=wp.i18n.__,y=wp.element,h=y.Component,m=y.Fragment,v=y.createRef,w=wp.components,g=w.Placeholder,O=w.Disabled,_=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(s,e);var t,n,r,i=l(s);function s(){var e;return u(this,s),(e=i.apply(this,arguments)).fbRef=v(),e.maybeInit=Object(a.debounce)(300,e.maybeInit.bind(p(e))),e}return t=s,(n=[{key:"componentDidMount",value:function(){this.maybeInit()}},{key:"componentDidUpdate",value:function(){this.maybeInit()}},{key:"maybeInit",value:function(){var e=this.props.attributes.href;if(this.fbRef&&this.fbRef.current&&e&&window.FB&&window.FB.XFBML){var t=this.fbRef.current,n=this.props.attributes,r=n.showCover,o=n.showFacepile,a=n.showPosts,i=n.smallHeader,u=r?"false":"true";o=o?"true":"false",a=a?"true":"false",i=i?"true":"false";var f=t.getAttribute("fb-iframe-plugin-query");if(f){var c=!1;try{c=JSON.parse('{"'+decodeURIComponent(f).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}')}catch(e){c=!1}if(c&&c.href===e&&c.hide_cover===u&&c.show_facepile===o&&c.show_posts===a&&c.small_header===i)return}t.attributes["fb-xfbml-state"]&&(t.attributes["fb-xfbml-state"]="re-rendering"),FB.XFBML.parse(t.parentNode)}}},{key:"render",value:function(){this.props.setAttributes;var e=this.props.className,t=this.props.attributes,n=t.href,r=t.showCover,a=t.showFacepile,i=t.showPosts,u=t.smallHeader,f=t.canvasClassName;return e=o()("fb-page-wrapper",f,e),wp.element.createElement(m,null,n?wp.element.createElement(O,null,wp.element.createElement("div",{className:e},wp.element.createElement("div",{className:"fb-page",ref:this.fbRef,"data-href":n,"data-hide-cover":r?"false":"true","data-show-facepile":a?"true":"false","data-show-posts":i?"true":"false","data-small-header":u?"true":"false","data-adapt-container-width":"true"}))):wp.element.createElement(g,null,d("Please, enter Facebook Fanpage URL.")))}}])&&f(t.prototype,n),r&&f(t,r),s}(h);(0,wp.hooks.addFilter)("canvas.customBlock.editRender","canvas/facebook-fanpage/editRender",(function(e,t){return"canvas/facebook-fanpage"===t.name?wp.element.createElement(_,t):e}))}]);
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const {
|
||||
addFilter,
|
||||
} = wp.hooks;
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import FacebookFanpageBlockEdit from './edit.jsx';
|
||||
|
||||
/**
|
||||
* Custom block Edit output for FacebookFanpage block.
|
||||
*
|
||||
* @param {JSX} edit Original block edit.
|
||||
* @param {Object} blockProps Block data.
|
||||
*
|
||||
* @return {JSX} Block edit.
|
||||
*/
|
||||
function editRender(edit, blockProps) {
|
||||
if ('canvas/facebook-fanpage' === blockProps.name) {
|
||||
return (
|
||||
<FacebookFanpageBlockEdit {...blockProps} />
|
||||
);
|
||||
}
|
||||
|
||||
return edit;
|
||||
}
|
||||
|
||||
addFilter('canvas.customBlock.editRender', 'canvas/facebook-fanpage/editRender', editRender);
|
||||
@@ -0,0 +1,152 @@
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import classnames from 'classnames';
|
||||
import { debounce } from 'throttle-debounce';
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
const {
|
||||
Component,
|
||||
Fragment,
|
||||
createRef,
|
||||
} = wp.element;
|
||||
|
||||
const {
|
||||
Placeholder,
|
||||
Disabled,
|
||||
} = wp.components;
|
||||
|
||||
/**
|
||||
* Component
|
||||
*/
|
||||
export default class FacebookFanpageBlockEdit extends Component {
|
||||
constructor() {
|
||||
super( ...arguments );
|
||||
|
||||
this.fbRef = createRef();
|
||||
|
||||
this.maybeInit = debounce( 300, this.maybeInit.bind( this ) );
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.maybeInit();
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
this.maybeInit();
|
||||
}
|
||||
|
||||
maybeInit() {
|
||||
const {
|
||||
href,
|
||||
} = this.props.attributes;
|
||||
|
||||
if ( ! this.fbRef || ! this.fbRef.current ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! href || ! window.FB || ! window.FB.XFBML ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const $ref = this.fbRef.current;
|
||||
|
||||
let {
|
||||
showCover,
|
||||
showFacepile,
|
||||
showPosts,
|
||||
smallHeader,
|
||||
} = this.props.attributes;
|
||||
|
||||
const hideCover = showCover ? 'false' : 'true';
|
||||
showFacepile = showFacepile ? 'true' : 'false';
|
||||
showPosts = showPosts ? 'true' : 'false';
|
||||
smallHeader = smallHeader ? 'true' : 'false';
|
||||
|
||||
// check if already rendered
|
||||
const $query = $ref.getAttribute( 'fb-iframe-plugin-query' );
|
||||
if ( $query ) {
|
||||
let queryObj = false;
|
||||
|
||||
try {
|
||||
// thanks https://stackoverflow.com/questions/8648892/convert-url-parameters-to-a-javascript-object
|
||||
queryObj = JSON.parse('{"' + decodeURIComponent( $query ).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}');
|
||||
} catch( e ) {
|
||||
queryObj = false;
|
||||
}
|
||||
|
||||
if (
|
||||
queryObj &&
|
||||
queryObj.href === href &&
|
||||
queryObj.hide_cover === hideCover &&
|
||||
queryObj.show_facepile === showFacepile &&
|
||||
queryObj.show_posts === showPosts &&
|
||||
queryObj.small_header === smallHeader
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// try to re-render
|
||||
if ( $ref.attributes['fb-xfbml-state'] ) {
|
||||
$ref.attributes['fb-xfbml-state'] = 're-rendering';
|
||||
}
|
||||
|
||||
FB.XFBML.parse( $ref.parentNode );
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
setAttributes,
|
||||
} = this.props;
|
||||
|
||||
let {
|
||||
className,
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
href,
|
||||
showCover,
|
||||
showFacepile,
|
||||
showPosts,
|
||||
smallHeader,
|
||||
canvasClassName,
|
||||
} = this.props.attributes;
|
||||
|
||||
className = classnames(
|
||||
'fb-page-wrapper',
|
||||
canvasClassName,
|
||||
className
|
||||
);
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
{ href ? (
|
||||
<Disabled>
|
||||
<div
|
||||
className={ className }
|
||||
>
|
||||
<div className="fb-page"
|
||||
ref={ this.fbRef }
|
||||
data-href={ href }
|
||||
data-hide-cover={ showCover ? 'false' : 'true' }
|
||||
data-show-facepile={ showFacepile ? 'true' : 'false' }
|
||||
data-show-posts={ showPosts ? 'true' : 'false' }
|
||||
data-small-header={ smallHeader ? 'true' : 'false' }
|
||||
data-adapt-container-width="true"
|
||||
/>
|
||||
</div>
|
||||
</Disabled>
|
||||
) : (
|
||||
<Placeholder>
|
||||
{ __( 'Please, enter Facebook Fanpage URL.' ) }
|
||||
</Placeholder>
|
||||
) }
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Facebook Fanpage block template
|
||||
*
|
||||
* @var $attributes - block attributes
|
||||
* @var $options - layout options
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package PowerKit
|
||||
* @subpackage PowerKit/templates
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div class="<?php echo esc_attr( $attributes['className'] ); ?>" <?php echo ( isset( $attributes['anchor'] ) ? ' id="' . esc_attr( $attributes['anchor'] ) . '"' : '' ); ?>>
|
||||
<div class="fb-page"
|
||||
data-href="<?php echo esc_url( $attributes['href'] ); ?>"
|
||||
data-hide-cover="<?php echo esc_attr( $attributes['showCover'] ? 'false' : 'true' ); ?>"
|
||||
data-show-facepile="<?php echo esc_attr( $attributes['showFacepile'] ? 'true' : 'false' ); ?>"
|
||||
data-show-posts="<?php echo esc_attr( $attributes['showPosts'] ? 'true' : 'false' ); ?>"
|
||||
data-small-header="<?php echo esc_attr( $attributes['smallHeader'] ? 'true' : 'false' ); ?>"
|
||||
data-adapt-container-width="true"
|
||||
></div>
|
||||
</div>
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
/**
|
||||
* Facebook Fanpage Block.
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Powerkit
|
||||
* @subpackage Modules/public
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize Facebook Fanpage block.
|
||||
*/
|
||||
class Powerkit_Block_Facebook_Fanpage {
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'init', array( $this, 'init' ) );
|
||||
add_filter( 'canvas_register_block_type', array( $this, 'register_block_type' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue the block's assets for the editor.
|
||||
*/
|
||||
public function init() {
|
||||
// Editor Scripts.
|
||||
wp_register_script(
|
||||
'powerkit-block-facebook-fanpage-editor-script',
|
||||
plugins_url( 'block/block.js', __FILE__ ),
|
||||
array( 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-editor', 'lodash', 'jquery' ),
|
||||
filemtime( plugin_dir_path( __FILE__ ) . 'block/block.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register block
|
||||
*
|
||||
* @param array $blocks all registered blocks.
|
||||
* @return array
|
||||
*/
|
||||
public function register_block_type( $blocks ) {
|
||||
$blocks[] = array(
|
||||
'name' => 'canvas/facebook-fanpage',
|
||||
'title' => esc_html__( 'Facebook Fanpage', 'powerkit' ),
|
||||
'description' => '',
|
||||
'category' => 'canvas',
|
||||
'keywords' => array( 'facebook', 'fanpage' ),
|
||||
'icon' => '
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
||||
<path d="M20 3H4C3.4 3 3 3.4 3 4V20C3 20.5 3.4 21 4 21H12.6V14H10.3V11.3H12.6V9.3C12.6 7 14 5.7 16.1 5.7C17.1 5.7 17.9 5.8 18.2 5.8V8.2H16.8C15.7 8.2 15.5 8.7 15.5 9.5V11.2H18.2L17.8 14H15.5V21H20C20.5 21 21 20.6 21 20V4C21 3.4 20.6 3 20 3Z" />
|
||||
</svg>
|
||||
',
|
||||
'supports' => array(
|
||||
'className' => true,
|
||||
'anchor' => true,
|
||||
'html' => false,
|
||||
'canvasSpacings' => true,
|
||||
'canvasBorder' => true,
|
||||
'canvasResponsive' => true,
|
||||
),
|
||||
'styles' => array(),
|
||||
'location' => array(),
|
||||
'sections' => array(
|
||||
'general' => array(
|
||||
'title' => esc_html__( 'Block Settings', 'powerkit' ),
|
||||
'priority' => 5,
|
||||
'open' => true,
|
||||
),
|
||||
),
|
||||
'layouts' => array(),
|
||||
|
||||
// Set fields just for add block attributes.
|
||||
// Editor render for this block is custom JSX
|
||||
// so we don't need to render fields automatically.
|
||||
'fields' => array(
|
||||
array(
|
||||
'key' => 'href',
|
||||
'label' => esc_html__( 'Facebook Fanpage URL', 'powerkit' ),
|
||||
'type' => 'text',
|
||||
'section' => 'general',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'key' => 'showCover',
|
||||
'label' => esc_html__( 'Display Cover', 'powerkit' ),
|
||||
'type' => 'toggle',
|
||||
'section' => 'general',
|
||||
'default' => true,
|
||||
),
|
||||
array(
|
||||
'key' => 'showFacepile',
|
||||
'label' => esc_html__( 'Display Facepile', 'powerkit' ),
|
||||
'type' => 'toggle',
|
||||
'section' => 'general',
|
||||
'default' => false,
|
||||
),
|
||||
array(
|
||||
'key' => 'showPosts',
|
||||
'label' => esc_html__( 'Display Posts', 'powerkit' ),
|
||||
'type' => 'toggle',
|
||||
'section' => 'general',
|
||||
'default' => false,
|
||||
),
|
||||
array(
|
||||
'key' => 'smallHeader',
|
||||
'label' => esc_html__( 'Small Header', 'powerkit' ),
|
||||
'type' => 'toggle',
|
||||
'section' => 'general',
|
||||
'default' => false,
|
||||
),
|
||||
),
|
||||
'template' => dirname( __FILE__ ) . '/block/render.php',
|
||||
// enqueue registered scripts/styles.
|
||||
'editor_script' => 'powerkit-block-facebook-fanpage-editor-script',
|
||||
);
|
||||
|
||||
return $blocks;
|
||||
}
|
||||
}
|
||||
|
||||
new Powerkit_Block_Facebook_Fanpage();
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* Shortcode Facebook Fanpage
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package PowerKit
|
||||
* @subpackage PowerKit/shortcodes
|
||||
*/
|
||||
|
||||
/**
|
||||
* Facebook Fanpage Shortcode
|
||||
*
|
||||
* @param array $atts User defined attributes in shortcode tag.
|
||||
* @param string $content Shorcode tag content.
|
||||
* @return string Shortcode result HTML.
|
||||
*/
|
||||
function powerkit_facebook_fanpage_shortcode( $atts, $content = '' ) {
|
||||
|
||||
$params = powerkit_shortcode_atts( shortcode_atts( array(
|
||||
'href' => '',
|
||||
'hide_cover' => false,
|
||||
'show_facepile' => false,
|
||||
'show_posts' => false,
|
||||
'small_header' => false,
|
||||
'adapt_container_width' => true,
|
||||
), $atts ) );
|
||||
|
||||
$params['hide_cover'] = filter_var( $params['hide_cover'], FILTER_VALIDATE_BOOLEAN );
|
||||
$params['show_facepile'] = filter_var( $params['show_facepile'], FILTER_VALIDATE_BOOLEAN );
|
||||
$params['show_posts'] = filter_var( $params['show_posts'], FILTER_VALIDATE_BOOLEAN );
|
||||
$params['small_header'] = filter_var( $params['small_header'], FILTER_VALIDATE_BOOLEAN );
|
||||
$params['adapt_container_width'] = filter_var( $params['adapt_container_width'], FILTER_VALIDATE_BOOLEAN );
|
||||
|
||||
ob_start();
|
||||
|
||||
if ( $params['href'] ) {
|
||||
?>
|
||||
<div class="fb-page-wrapper">
|
||||
<div class="fb-page"
|
||||
data-href="<?php echo esc_attr( $params['href'] ); ?>"
|
||||
data-hide-cover="<?php echo esc_attr( $params['hide_cover'] ? 'true' : 'false' ); ?>"
|
||||
data-show-facepile="<?php echo esc_attr( $params['show_facepile'] ? 'true' : 'false' ); ?>"
|
||||
data-show-posts="<?php echo esc_attr( $params['show_posts'] ? 'true' : 'false' ); ?>"
|
||||
data-small-header="<?php echo esc_attr( $params['small_header'] ? 'true' : 'false' ); ?>"
|
||||
data-adapt-container-width="<?php echo esc_attr( $params['adapt_container_width'] ? 'true' : 'false' ); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
powerkit_alert_warning( esc_html__( 'The "Facebook Fanpage URL" field is required!', 'powerkit' ) );
|
||||
}
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
add_shortcode( 'powerkit_facebook_fanpage', 'powerkit_facebook_fanpage_shortcode' );
|
||||
|
||||
/**
|
||||
* Map Facebook Fanpage Shortcode into the Basic Shortcodes Plugin
|
||||
*/
|
||||
if ( function_exists( 'powerkit_basic_shortcodes_register' ) ) :
|
||||
|
||||
powerkit_basic_shortcodes_register( array(
|
||||
'name' => 'facebook_fanpage',
|
||||
'title' => esc_html__( 'Facebook Fanpage', 'powerkit' ),
|
||||
'priority' => 150,
|
||||
'base' => 'powerkit_facebook_fanpage',
|
||||
'autoregister' => false,
|
||||
'fields' => array(
|
||||
array(
|
||||
'type' => 'input',
|
||||
'name' => 'href',
|
||||
'label' => esc_html__( 'Facebook fanpage URL', 'powerkit' ),
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'hide_cover',
|
||||
'label' => esc_html__( 'Hide cover', 'powerkit' ),
|
||||
'default' => false,
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'show_facepile',
|
||||
'label' => esc_html__( 'Show facepile', 'powerkit' ),
|
||||
'default' => false,
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'show_posts',
|
||||
'label' => esc_html__( 'Show posts', 'powerkit' ),
|
||||
'default' => false,
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'small_header',
|
||||
'label' => esc_html__( 'Small header', 'powerkit' ),
|
||||
'default' => false,
|
||||
),
|
||||
),
|
||||
) );
|
||||
|
||||
endif;
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
/**
|
||||
* Widget Facebook Fanpage
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package PowerKit
|
||||
* @subpackage PowerKit/widgets
|
||||
*/
|
||||
|
||||
/**
|
||||
* Widget Facebook Fanpage Class
|
||||
*/
|
||||
class Powerkit_Facebook_Fanpage_Widget extends WP_Widget {
|
||||
|
||||
/**
|
||||
* Sets up a new widget instance.
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->default_settings = apply_filters( 'powerkit_facebook_fanpage_widget_settings', array(
|
||||
'title' => esc_html__( 'Facebook Fanpage', 'powerkit' ),
|
||||
'href' => '',
|
||||
'hide_cover' => false,
|
||||
'show_facepile' => false,
|
||||
'show_posts' => false,
|
||||
'small_header' => false,
|
||||
'adapt_container_width' => true,
|
||||
) );
|
||||
|
||||
$widget_details = array(
|
||||
'classname' => 'powerkit_facebook_fanpage_widget',
|
||||
'description' => esc_html__( 'A Facebook Fanpage widget.', 'powerkit' ),
|
||||
);
|
||||
parent::__construct( 'powerkit_facebook_fanpage_widget', esc_html__( 'Facebook Fanpage', 'powerkit' ), $widget_details );
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the content for the current widget instance.
|
||||
*
|
||||
* @param array $args Display arguments including 'before_title', 'after_title',
|
||||
* 'before_widget', and 'after_widget'.
|
||||
* @param array $instance Settings for the current widget instance.
|
||||
*/
|
||||
public function widget( $args, $instance ) {
|
||||
$params = array_merge( $this->default_settings, $instance );
|
||||
|
||||
// Before Widget.
|
||||
echo $args['before_widget']; // XSS OK.
|
||||
?>
|
||||
|
||||
<div class="widget-body">
|
||||
<?php
|
||||
|
||||
// Title.
|
||||
if ( $params['title'] ) {
|
||||
echo $args['before_title'] . apply_filters( 'widget_title', wp_kses( $params['title'], 'pk-title' ), $instance, $this->id_base ) . $args['after_title']; // XSS.
|
||||
}
|
||||
|
||||
if ( $params['href'] ) {
|
||||
?>
|
||||
<div class="fb-page-wrapper">
|
||||
<div class="fb-page"
|
||||
data-href="<?php echo esc_attr( $params['href'] ); ?>"
|
||||
data-hide-cover="<?php echo esc_attr( $params['hide_cover'] ? 'true' : 'false' ); ?>"
|
||||
data-show-facepile="<?php echo esc_attr( $params['show_facepile'] ? 'true' : 'false' ); ?>"
|
||||
data-show-posts="<?php echo esc_attr( $params['show_posts'] ? 'true' : 'false' ); ?>"
|
||||
data-small-header="<?php echo esc_attr( $params['small_header'] ? 'true' : 'false' ); ?>"
|
||||
data-adapt-container-width="<?php echo esc_attr( $params['adapt_container_width'] ? 'true' : 'false' ); ?>"
|
||||
data-width="500px">
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
powerkit_alert_warning( esc_html__( 'The "Facebook Fanpage URL" field is required!', 'powerkit' ) );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
// After Widget.
|
||||
echo $args['after_widget']; // XSS OK.
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles updating settings for the current widget instance.
|
||||
*
|
||||
* @param array $new_instance New settings for this instance as input by the user via
|
||||
* WP_Widget::form().
|
||||
* @param array $old_instance Old settings for this instance.
|
||||
* @return array Settings to save or bool false to cancel saving.
|
||||
*/
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
$instance = $new_instance;
|
||||
|
||||
// Hide cover.
|
||||
if ( ! isset( $instance['hide_cover'] ) ) {
|
||||
$instance['hide_cover'] = false;
|
||||
}
|
||||
|
||||
// Show facepile.
|
||||
if ( ! isset( $instance['show_facepile'] ) ) {
|
||||
$instance['show_facepile'] = false;
|
||||
}
|
||||
|
||||
// Show posts.
|
||||
if ( ! isset( $instance['show_posts'] ) ) {
|
||||
$instance['show_posts'] = false;
|
||||
}
|
||||
|
||||
// Small header.
|
||||
if ( ! isset( $instance['small_header'] ) ) {
|
||||
$instance['small_header'] = false;
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the widget settings form.
|
||||
*
|
||||
* @param array $instance Current settings.
|
||||
*/
|
||||
public function form( $instance ) {
|
||||
$params = array_merge( $this->default_settings, $instance );
|
||||
?>
|
||||
<!-- Title -->
|
||||
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'powerkit' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $params['title'] ); ?>" /></p>
|
||||
|
||||
<!-- Facebook Fanpage URL -->
|
||||
<p><label for="<?php echo esc_attr( $this->get_field_id( 'href' ) ); ?>"><?php esc_html_e( 'Facebook fanpage URL:', 'powerkit' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'href' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'href' ) ); ?>" type="text" value="<?php echo esc_attr( $params['href'] ); ?>" /></p>
|
||||
|
||||
<!-- Hide Cover -->
|
||||
<p><input id="<?php echo esc_attr( $this->get_field_id( 'hide_cover' ) ); ?>" class="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'hide_cover' ) ); ?>" type="checkbox" <?php checked( (bool) $params['hide_cover'] ); ?> />
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'hide_cover' ) ); ?>"><?php esc_html_e( 'Hide cover', 'powerkit' ); ?></label></p>
|
||||
|
||||
<!-- Show Facepile -->
|
||||
<p><input id="<?php echo esc_attr( $this->get_field_id( 'show_facepile' ) ); ?>" class="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'show_facepile' ) ); ?>" type="checkbox" <?php checked( (bool) $params['show_facepile'] ); ?> />
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'show_facepile' ) ); ?>"><?php esc_html_e( 'Show facepile', 'powerkit' ); ?></label></p>
|
||||
|
||||
<!-- Show Posts -->
|
||||
<p><input id="<?php echo esc_attr( $this->get_field_id( 'show_posts' ) ); ?>" class="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'show_posts' ) ); ?>" type="checkbox" <?php checked( (bool) $params['show_posts'] ); ?> />
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'show_posts' ) ); ?>"><?php esc_html_e( 'Show posts', 'powerkit' ); ?></label></p>
|
||||
|
||||
<!-- Small Header -->
|
||||
<p><input id="<?php echo esc_attr( $this->get_field_id( 'small_header' ) ); ?>" class="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'small_header' ) ); ?>" type="checkbox" <?php checked( (bool) $params['small_header'] ); ?> />
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'small_header' ) ); ?>"><?php esc_html_e( 'Small header', 'powerkit' ); ?></label></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Widget
|
||||
*/
|
||||
function powerkit_widget_init_facebook() {
|
||||
register_widget( 'Powerkit_Facebook_Fanpage_Widget' );
|
||||
}
|
||||
add_action( 'widgets_init', 'powerkit_widget_init_facebook' );
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* The public-facing functionality of the module.
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Powerkit
|
||||
* @subpackage Modules/public
|
||||
*/
|
||||
|
||||
/**
|
||||
* The public-facing functionality of the module.
|
||||
*/
|
||||
class Powerkit_Facebook_Public extends Powerkit_Module_Public {
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
public function initialize() {
|
||||
add_action( 'init', array( $this, 'facebook_load_sdk' ) );
|
||||
add_action( 'current_screen', array( $this, 'facebook_load_sdk_gutenberg' ) );
|
||||
add_action( 'init', array( $this, 'register_locations' ) );
|
||||
add_filter( 'powerkit_facebook_comments_location', array( $this, 'location_default' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Init Facebook
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
*/
|
||||
public function facebook_load_sdk() {
|
||||
add_action( 'wp_footer', 'powerkit_facebook_load_sdk' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Init Facebook in Gutenberg editor
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
*/
|
||||
public function facebook_load_sdk_gutenberg() {
|
||||
global $current_screen;
|
||||
|
||||
$current_screen = get_current_screen();
|
||||
|
||||
// add on the editor page.
|
||||
if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {
|
||||
add_action( 'admin_footer', 'powerkit_facebook_load_sdk' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Facebook Register Locations
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
*/
|
||||
public function register_locations() {
|
||||
|
||||
$locations = apply_filters( 'powerkit_facebook_comments_location', array() );
|
||||
|
||||
$powerkit_facebook_enable_comments = get_option( 'powerkit_facebook_enable_comments' );
|
||||
$powerkit_facebook_location = get_option( 'powerkit_facebook_location' );
|
||||
|
||||
// Select location.
|
||||
if ( isset( $locations[ $powerkit_facebook_location ] ) ) {
|
||||
|
||||
$location = $locations[ $powerkit_facebook_location ];
|
||||
|
||||
} elseif ( isset( $locations['default'] ) ) {
|
||||
|
||||
$location = $locations['default'];
|
||||
|
||||
} else {
|
||||
$location = false;
|
||||
}
|
||||
|
||||
if ( $powerkit_facebook_enable_comments && $location ) {
|
||||
$priority = (int) isset( $location['priority'] ) ? $location['priority'] : 99;
|
||||
|
||||
if ( 'comments_template' === $location['action'] ) {
|
||||
|
||||
add_filter( 'comments_template', function () {
|
||||
return plugin_dir_path( dirname( __FILE__ ) ) . 'public/facebook-comments-template.php';
|
||||
}, $priority );
|
||||
|
||||
} elseif ( 'before_comments' === $location['action'] ) {
|
||||
|
||||
add_action( 'comments_template', function () {
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/facebook-comments-template.php';
|
||||
}, $priority );
|
||||
|
||||
} elseif ( 'after_comments' === $location['action'] ) {
|
||||
/**
|
||||
* Filter After WordPress Comments
|
||||
*/
|
||||
function powerkit_filter_comments_template() {
|
||||
remove_filter( 'comments_template', 'powerkit_filter_comments_template', 99 );
|
||||
|
||||
comments_template();
|
||||
|
||||
return plugin_dir_path( dirname( __FILE__ ) ) . 'public/facebook-comments-template.php';
|
||||
}
|
||||
add_filter( 'comments_template', 'powerkit_filter_comments_template', 99 );
|
||||
|
||||
} else {
|
||||
|
||||
add_action( $location['action'], function () {
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/facebook-comments-template.php';
|
||||
}, $priority );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter Register Locations
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $locations List of Locations.
|
||||
*/
|
||||
public function location_default( $locations = array() ) {
|
||||
|
||||
$locations = array(
|
||||
'before_comments' => array(
|
||||
'name' => 'Before WordPress Comments',
|
||||
'action' => 'before_comments',
|
||||
'priority' => 99,
|
||||
),
|
||||
'after_comments' => array(
|
||||
'name' => 'After WordPress Comments',
|
||||
'action' => 'after_comments',
|
||||
'priority' => 99,
|
||||
),
|
||||
'default' => array(
|
||||
'name' => 'In place of WordPress Comments',
|
||||
'action' => 'comments_template',
|
||||
'priority' => 99,
|
||||
),
|
||||
);
|
||||
|
||||
return $locations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the stylesheets for the public-facing side of the site.
|
||||
*/
|
||||
public function wp_enqueue_scripts() {
|
||||
wp_enqueue_style( 'powerkit-facebook', powerkit_style( plugin_dir_url( __FILE__ ) . 'css/public-powerkit-facebook.css' ), array(), powerkit_get_setting( 'version' ), 'all' );
|
||||
|
||||
// Add RTL support.
|
||||
wp_style_add_data( 'powerkit-facebook', 'rtl', 'replace' );
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* All of the CSS for your public-facing functionality should be
|
||||
* included in this file.
|
||||
*/
|
||||
/**
|
||||
* Environment for all styles (variables, additions, etc).
|
||||
*/
|
||||
/*--------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------*/
|
||||
.fb-page-wrapper {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fb-comments {
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
.fb-comments,
|
||||
.fb-comments iframe[style],
|
||||
.fb-comments span {
|
||||
width: 100% !important;
|
||||
right: 0;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* All of the CSS for your public-facing functionality should be
|
||||
* included in this file.
|
||||
*/
|
||||
/**
|
||||
* Environment for all styles (variables, additions, etc).
|
||||
*/
|
||||
/*--------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------*/
|
||||
.fb-page-wrapper {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fb-comments {
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
.fb-comments,
|
||||
.fb-comments iframe[style],
|
||||
.fb-comments span {
|
||||
width: 100% !important;
|
||||
left: 0;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Facebook Comments Template
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package PowerKit
|
||||
* @subpackage PowerKit/templates
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ( powerkit_connect( 'facebook_app_id' ) ) {
|
||||
?>
|
||||
<div class="fb-comments" data-width="100%" data-href="<?php the_permalink(); ?>" data-numposts="<?php get_option( 'powerkit_facebook_number_comments', 10 ); ?>"></div>
|
||||
<?php
|
||||
} else {
|
||||
/* translators: Facebook API Link. */
|
||||
powerkit_alert_warning( __( 'Warning: Facebook ID not specified!', 'powerkit' ) );
|
||||
}
|
||||
Reference in New Issue
Block a user