Fragmentos de código para hacer modificaciones útiles en WordPress.
Incluídos en la entrada http://wprincipiante.es/codigo-util-wordpress/
Fragmentos de código para hacer modificaciones útiles en WordPress.
Incluídos en la entrada http://wprincipiante.es/codigo-util-wordpress/
edit: function( props ) { | |
var focus = props.focus; | |
var focusedEditable = props.focus ? props.focus.editable || 'name' : null; | |
var alignment = props.attributes.alignment; | |
var attributes = props.attributes; | |
var contactURL = props.attributes.contactURL; | |
var onSelectImage = function( media ) { | |
return props.setAttributes( { |
save: function( props ) { | |
var attributes = props.attributes; | |
var alignment = props.attributes.alignment; | |
return ( | |
el( 'div', { className: props.className }, | |
attributes.mediaURL && | |
el( 'div', { className: 'nelio-testimonial-image', style: { backgroundImage: 'url('+attributes.mediaURL+')' } }, | |
el( 'img', { src: attributes.mediaURL } ), | |
), | |
el( 'div', { className: 'nelio-testimonial-content', style: { textAlign: attributes.alignment } }, |
<?php | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
}//end if | |
/** | |
* Enqueue the block's assets for the editor. | |
* | |
* `wp-blocks`: Includes block type registration and related functions. |
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
( function( blocks, components, i18n, element ) { | |
var el = element.createElement; | |
blocks.registerBlockType( | |
// The name of our block. Must be a string with prefix. Example: my-plugin/my-custom-block. | |
'nelio/testimonial-block', { | |
// The title of our block. | |
title: i18n.__( 'Testimonial' ), |
<?php | |
function create_post_type() { | |
register_post_type( 'recipe', | |
array( | |
'labels' => array( | |
'name' => __( 'Recipes', 'nelio' ), | |
'singular_name' => __( 'Recipe', 'nelio' ) | |
), | |
'public' => true, |
<?php | |
// Register Custom Post Type | |
function custom_post_type() { | |
$labels = array( | |
'name' => _x( 'Recipes', 'Post Type General Name', 'nelio' ), | |
'singular_name' => _x( 'Recipe', 'Post Type Singular Name', 'nelio' ), | |
'menu_name' => __( 'Recipes', 'nelio' ), | |
'name_admin_bar' => __( 'Recipe', 'nelio' ), |
[ | |
{ | |
"key": "group_5bf27651e03b6", | |
"title": "Social Images", | |
"fields": [ | |
{ | |
"key": "field_5bf2766a5c07d", | |
"label": "Facebook", | |
"name": "nc-facebook-featured-image", | |
"type": "image", |
class Product extends Component { | |
render() { | |
return wp.element.createElement( | |
"div", | |
{ className: "product" }, | |
wp.element.createElement( | |
"p", | |
null, | |
this.props.name | |
) |