This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return ( | |
<Fragment> | |
<InspectorControls> | |
<PanelBody title={ __( 'RSS Feed Settings' ) }> | |
<RangeControl | |
label={ __( 'Number of posts to be shown on the front-end' ) } | |
value={ numberOfPosts } | |
min='1' | |
max='50' | |
onChange={ onChangeNumber } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setState( { error: true } ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const onChangeURL = newURL => { | |
setAttributes( { url: newURL } ); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const edit = ( { attributes, className, setAttributes, setState, error, validated } ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WordPress dependencies | |
const { __ } = wp.i18n; | |
const { Fragment } = wp.element; | |
const { registerBlockType } = wp.blocks; | |
const { InspectorControls } = wp.editor; | |
const { withState } = wp.compose; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
registerBlockType('gutenberg-widget-block/rss-feed', { | |
title: 'RSS Feed', | |
icon: 'rss', | |
category: 'widgets', | |
attributes: { | |
numberOfPosts: { | |
type: 'integer', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); | |
if( is_plugin_active( 'gutenberg/gutenberg.php' ) ) { | |
return true; | |
} | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
wp_register_script( | |
'gutenberg-block-rss-feed', | |
plugins_url( 'dist/bundle.js', __FILE__ ), | |
array( 'wp-blocks', 'wp-element' ) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_block_type( 'gutenberg-widget-block/rss-feed', array( | |
'editor_script' => 'gutenberg-block-rss-feed', | |
'render_callback' => array('GRF_Frontend', 'render'), | |
) ); |