brew install zsh
echo $(which zsh) | sudo tee -a /etc/shells
sudo chsh -s $(which zsh) $USER
<?php | |
$key_file_path = __DIR__ . '/service-account-credentials.json'; | |
$google_client = new \Google_Client(); | |
$google_client->setAuthConfig( $key_file_path ); | |
// Set the scopes of whatever you need access to | |
// See https://developers.google.com/identity/protocols/oauth2/scopes | |
$google_client->setScopes( array( 'https://www.googleapis.com/auth/analytics.readonly' ) ); | |
$http_client = $client->authorize(); |
<?php | |
function rh_filter_the_content( $the_content = '' ) { | |
$blocks = parse_blocks( $the_content ); | |
$new_block = array( | |
'blockName' => 'core/paragraph', | |
'attrs' => array(), | |
'innerBlocks' => array(), | |
'innerHTML' => '<p>Hello World</p>', | |
'innerContent' => array( | |
'<p>Hello World</p>', |
<?php | |
/** | |
* A function that takes an array of HTML attribute | |
* key/value pairs and returns a string of HTML attributes. | |
**/ | |
function unwrap_html_attrs($attrs) | |
{ | |
$attributes = ''; |
Adding @k1sul1's suggestion from the comments as it's more concise than what I had before:
I just wanted them all gone, so I ran this in the MySQL shell.
UPDATE wp_posts SET post_content = REGEXP_REPLACE(post_content, "\\[\/?vc(.*?)\]", "");
OR You can also do with with WP-CLI:
wp search-replace --regex --verbose "\\[\/?vc(.*?)\]" "" wp_posts
<?php | |
namespace JensSogaard; | |
class BlockHelper | |
{ | |
/** | |
* Gets ACF fields for a specific block on a given post | |
* @author Jens Soegaard <jens@jenssogaard.com> | |
*/ | |
public function getBlockFromPage(string $block_id, int $post_id) |
As of WordPress 5.8 release, we encourage using block.json
file metadata as the canonical way to register block types. We have been working on Block Metadata specification for a few major WordPress releases, and we reached the point where all planned features are in place.
Example:
notice/block.json
{
"apiVersion": 2,
We have reached the first WordPress core release where the post editor is no longer the only screen that uses the block editor. In the middle of the development process, we found out that several WordPress hooks defined on the server depended on the $post
object that isn’t present on the updated screen that lets users edit widgets using blocks. Therefore, we decided to deprecate some of the existing filters and introduce their context-aware replacements. This way, we ensure that we can continue iteratively enabling the block-based paradigm on different screens like the navigation editor screen by leveraging the new WP_Block_Editor_Context
class that will receive more capabilities over time. There are also new methods introduced that allow code reuse for the functionality that needs to be shared between the screen that uses the block editor.
Related Trac ticket: #52920.
{ | |
"title": "JSON schema for WordPress blocks", | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"definitions": { | |
"//": { | |
"reference": "https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/", | |
"attributesReference": "https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/", | |
"contextReference": "https://developer.wordpress.org/block-editor/reference-guides/block-api/block-context/", | |
"supportsReference": "https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/", | |
"registerReference": "https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/#example-optional" |
<?php | |
/* Customiser script */ | |
add_action( 'customize_register', 'custom_editor' ); | |
function custom_editor( $wp_customize ) { | |
// Analytics section | |
$wp_customize->add_section('analytics_section', array( | |
'title' => __( 'Analytics', 'tuesday' ), | |
'description' => __( 'Enable tracking and analytics by placing your script tags in the correct location. <small><strong>Note:</strong> All scripts must be self-containing <script></script>, otherwise they will just print the code onto the website.</small>', 'tuesday' ), |