Skip to content

Instantly share code, notes, and snippets.

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