Skip to content

Instantly share code, notes, and snippets.

@jasperf
Last active July 20, 2026 05:23
Show Gist options
  • Select an option

  • Save jasperf/e2ddaee1510b2f58b74149f362af10ae to your computer and use it in GitHub Desktop.

Select an option

Save jasperf/e2ddaee1510b2f58b74149f362af10ae to your computer and use it in GitHub Desktop.
Apply Night Style to existing block on homepage
<?php
// One-off: apply the Night block style to the hero-split on the aviendha Home page (post 6).
$p = get_post( 6 );
if ( ! $p ) {
WP_CLI::error( 'Post 6 not found' );
}
$c = $p->post_content;
if ( strpos( $c, 'is-style-night' ) !== false ) {
WP_CLI::success( 'Already applied' );
return;
}
$before = $c;
$c = str_replace(
'<!-- wp:aludra/hero-split -->',
'<!-- wp:aludra/hero-split {"className":"is-style-night"} -->',
$c
);
$c = str_replace(
'class="wp-block-aludra-hero-split alignfull"',
'class="wp-block-aludra-hero-split is-style-night alignfull"',
$c
);
if ( $c === $before ) {
WP_CLI::error( 'No replacements made — markup differs from expectation' );
}
$r = wp_update_post( array( 'ID' => 6, 'post_content' => wp_slash( $c ) ), true );
if ( is_wp_error( $r ) ) {
WP_CLI::error( $r->get_error_message() );
}
WP_CLI::success( 'Night style applied to post 6' );
# The page still shows the old cream hero — likely markup or CSS caching. Let me check what's actually being served:
curl -s http://demo.imagewize.test/aviendha/ | grep -o 'wp-block-aludra-hero-split[^"]*' | head -2; echo ---; curl -s http://demo.imagewize.test/aviendha/ | grep -oE 'hero-split/build/style-index\.css[^"]*' | head -2
Check live HTML for night class and hero-split stylesheet version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment