Skip to content

Instantly share code, notes, and snippets.

View aatanasovdev's full-sized avatar

Aleksandar Atanasov aatanasovdev

View GitHub Profile
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 }
setState( { error: true } );
const onChangeURL = newURL => {
setAttributes( { url: newURL } );
};
export const edit = ( { attributes, className, setAttributes, setState, error, validated } )
// WordPress dependencies
const { __ } = wp.i18n;
const { Fragment } = wp.element;
const { registerBlockType } = wp.blocks;
const { InspectorControls } = wp.editor;
const { withState } = wp.compose;
registerBlockType('gutenberg-widget-block/rss-feed', {
title: 'RSS Feed',
icon: 'rss',
category: 'widgets',
attributes: {
numberOfPosts: {
type: 'integer',
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if( is_plugin_active( 'gutenberg/gutenberg.php' ) ) {
return true;
}
return false;
<?php
wp_register_script(
'gutenberg-block-rss-feed',
plugins_url( 'dist/bundle.js', __FILE__ ),
array( 'wp-blocks', 'wp-element' )
);
<?php
register_block_type( 'gutenberg-widget-block/rss-feed', array(
'editor_script' => 'gutenberg-block-rss-feed',
'render_callback' => array('GRF_Frontend', 'render'),
) );