This file contains hidden or 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 | |
class ACF_Image_Upload { | |
public $post_id; | |
function update_acf ( ) { | |
$attach_id = $this->get_image_attach_id('my-image.jpg'); | |
// Saving image |
This file contains hidden or 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 | |
class Plugin_Templates_Loader { | |
/** | |
* Templates folder inside the plugin | |
*/ | |
private $templates_dir; | |
/** |
This file contains hidden or 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 | |
// Gets Template Name from the file | |
$filedata = get_file_data($full_path, array( | |
'Template Name' => 'Template Name', | |
)); |
This file contains hidden or 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 | |
/** | |
* theme_page_templates Filter callback | |
* | |
* Merges plugins' template with theme's, making them available for the user | |
* | |
* @param array $theme_templates | |
* @return array $theme_templates | |
*/ | |
function register_plugin_templates ( $theme_templates ) { |
This file contains hidden or 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 | |
/** | |
* template_include Filter callback | |
* | |
* Include plugin's template if there's one chosen for the rendering page | |
* | |
* @param string $template path | |
* @return string $template path | |
*/ | |
public function add_template_filter ( $template ) { |
This file contains hidden or 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 | |
/** | |
* Registers a Gutenberg block JS script and its styles | |
* | |
* @since 1.0.0 | |
* @return void | |
*/ | |
public function register_block_action ( ) { | |
$block_name = 'my_block'; |
This file contains hidden or 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
/** | |
* Simple block | |
* | |
* Creates a simple block that makes a red title | |
* | |
* @requires Gutenberg 4.3 | |
*/ | |
// Required components | |
const { registerBlockType } = wp.blocks; // registerBlockType function that creates a block |
This file contains hidden or 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
/** | |
* Simple editable block sample | |
* | |
* Creates an editable block to make a link | |
*/ | |
// Required components | |
const { __ } = wp.i18n; | |
const { registerBlockType, RichText, source } = wp.blocks; |
This file contains hidden or 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
/** | |
* Simple editable block with inspection controls | |
* | |
* Creates an editable block to make a link button, but with inspection controlls on the sidebar | |
*/ | |
/** | |
* Required components | |
*/ |
This file contains hidden or 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 | |
/** | |
* Registers the dynamic server side block JS script and its styles | |
* | |
* @since 1.0.0 | |
* @return void | |
*/ | |
public function register_dynamic_block_action ( ) { | |
$block_name = 'block-dynamic'; |
OlderNewer