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
name: Deploy to WP Engine | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: "prd/dev/staging/. Default is dev" | |
required: false | |
default: "" | |
jobs: |
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
import {registerPlugin} from '@wordpress/plugins'; | |
import {select, dispatch} from '@wordpress/data'; | |
import {BlockControls} from '@wordpress/block-editor'; | |
import {ToolbarButton, ToolbarGroup} from '@wordpress/components'; | |
import {trash, group} from '@wordpress/icons'; | |
const CloneButton = () => (<ToolbarButton | |
icon={group} | |
onClick={cloneSelectedBlocks} | |
label={'Clone Block'} |
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 | |
add_filter( 'sgf_register_fields', 'sgf_post_fields' ); | |
// Register operator fields | |
function sgf_post_fields( $fields_array ) { | |
//Simple text field | |
$fields_array[] = [ | |
'meta_key' => 'publisher', | |
]; |
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
import {MediaUpload, MediaUploadCheck} from '@wordpress/block-editor'; | |
const {Button} = wp.components | |
const {dispatch, useSelect} = wp.data | |
const ALLOWED_MEDIA_TYPES = ['image']; | |
const ImagePlaceholder = () => ( | |
<div style={{ | |
width: '100%', |
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
import controlsIndex from "./controlsIndex"; | |
const {select, withDispatch, useSelect} = wp.data | |
const InnerControlComponent = props => { | |
const {key, field, row_index, property_key, repeater_record_label} = props | |
let ControlField = controlsIndex['text'] | |
let repeaterValues = select('core/editor').getEditedPostAttribute('meta')?.[props.meta_key] |
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 {withSelect, select, withDispatch, useSelect} = wp.data | |
const {TextControl} = wp.components | |
const ControlField = withSelect( | |
(select, props) => { | |
const { label, meta_key} = props.field; | |
const {row_index,property_key} = props | |
const value = select('core/editor').getEditedPostAttribute('meta')[meta_key]; | |
const key = meta_key + row_index + property_key; |
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
import TextField from "./TextControl"; | |
import ColorPickerComponent from "./ColorPicker"; | |
import SelectControlComponent from "./SelectControl"; | |
import MediaUpload from "./MediaUpload"; | |
import RepeaterControl from "./RepeaterControl"; | |
const controlsIndex = | |
{ | |
text: TextField, | |
color: ColorPickerComponent, |
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
import {registerPlugin} from '@wordpress/plugins'; | |
import {PluginDocumentSettingPanel} from '@wordpress/edit-post'; | |
import TextFieldHoc from './TextControlHoc' | |
import SelectControlHoc from './SelectControlHoc' | |
import ColorPickerHoc from './ColorPickerHoc' | |
import MediaUploadHoc from './MediaUploadHoc' | |
import RepeaterControlHoc from './RepeaterControlHoc' | |
const controlsIndex = | |
{ |
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 | |
function sgf_load_scripts() { | |
$dir = __DIR__; | |
$script_asset_path = "$dir/build/index.asset.php"; | |
if ( ! file_exists( $script_asset_path ) ) { | |
throw new Error( | |
'You need to run `npm start` or `npm run build` for the "create-block/simple-guten-fields" block first.' | |
); | |
} |
NewerOlder