Posted in:
+
+
+
+
—
diff --git a/lib/class-enqueue.php b/lib/class-enqueue.php
index 8bb55c3..722eb62 100644
--- a/lib/class-enqueue.php
+++ b/lib/class-enqueue.php
@@ -51,7 +51,8 @@ class Enqueue {
if ( file_exists( $theme_dir . $js_path ) ) {
$version = filemtime( $theme_dir . $js_path );
- wp_enqueue_script_module( 'basicwp-theme', $theme_uri . $js_path, array( 'jquery' ), $version, true );
+ wp_enqueue_script( 'jquery' ); // Needed by downstream scripts; modules can't depend on classic scripts.
+ wp_enqueue_script_module( 'basicwp-theme', $theme_uri . $js_path, array(), $version, true );
wp_enqueue_script_module( 'basicwp-button', $theme_uri . '/static/js/components/button.js', array( 'basicwp-theme' ), $version, true );
}
}
@@ -90,7 +91,8 @@ class Enqueue {
$admin_js_path = '/static/js/admin.js';
if ( file_exists( $theme_dir . $admin_js_path ) ) {
$version = filemtime( $theme_dir . $admin_js_path );
- wp_enqueue_script_module( 'basicwp-admin', $theme_uri . $admin_js_path, array( 'jquery' ), $version, true );
+ wp_enqueue_script( 'jquery' ); // Needed by downstream scripts; modules can't depend on classic scripts.
+ wp_enqueue_script_module( 'basicwp-admin', $theme_uri . $admin_js_path, array(), $version, true );
wp_enqueue_script_module( 'basicwp-button', $theme_uri . '/static/js/components/button.js', array( 'basicwp-admin' ), $version, true );
}
}
diff --git a/lib/helpers.php b/lib/helpers.php
index ad1e75e..be9223f 100644
--- a/lib/helpers.php
+++ b/lib/helpers.php
@@ -164,6 +164,50 @@ function escEmbeds() {
);
}
+/**
+ * Finds the numeric position of the first occurrence of a needle in a haystack array.
+ *
+ * @param string $haystack The string to search in.
+ * @param mixed $needles The array of strings to search for.
+ * @param int $offset (Optional) The position to start the search from.
+ * @return int|false The numeric position of the first occurrence of a needle in the haystack array.
+ */
+function strposArray( $haystack, $needles, $offset = 0 ) {
+ if ( is_array( $needles ) ) {
+ $positions = array();
+
+ foreach ( $needles as $str ) {
+ $pos = strpos( $haystack, $str, $offset );
+
+ if ( $pos !== false ) {
+ $positions[] = $pos; }
+ }
+
+ return count( $positions ) ? min( $positions ) : false;
+ } else {
+ return strpos( $haystack, $needles, $offset );
+ }
+}
+
+/**
+ * Generates a custom excerpt for the given text.
+ *
+ * @param string $text The text to generate the excerpt from.
+ * @param int $number_of_words The maximum number of words in the excerpt. Default is 55.
+ * @param string|null $more The string to append to the end of the excerpt if it is truncated. Default is null.
+ * @return void
+ */
+function customExcerpt( $text, $number_of_words = 55, $more = null ) {
+ $allowed_end = array( '.', '!', '?', '...' );
+ $text_no_html = wp_strip_all_tags( $text );
+ $trimmed_text = wp_trim_words( $text, $number_of_words, $more );
+ $trimmed_text_length = strlen( $trimmed_text );
+ $sentence_end_position = strposArray( $text_no_html, $allowed_end, $trimmed_text_length );
+ $text_with_html = ( ( $sentence_end_position !== false ) ? substr( $text_no_html, 0, ( $sentence_end_position + 1 ) ) : $trimmed_text );
+
+ echo wp_kses_post( wpautop( $text_with_html ) );
+}
+
/** Print a variable to the console for debugging purposes.
*
* @param mixed $data The data to print to the console.
diff --git a/styles/base/global.css b/styles/base/global.css
index a5bd703..3c65906 100644
--- a/styles/base/global.css
+++ b/styles/base/global.css
@@ -32,6 +32,7 @@ main#maincontent {
.container {
margin: 0 auto;
width: 100%;
+ padding-inline: clamp(1.5rem, 5vw, 3rem);
}
.section {
diff --git a/theme.json b/theme.json
index e1f1ead..003a6e9 100644
--- a/theme.json
+++ b/theme.json
@@ -3,7 +3,7 @@
"version": 3,
"settings": {
"layout": {
- "contentSize": "840px",
+ "contentSize": "100%",
"wideSize": "1536px"
},
"color": {
diff --git a/views/blocks/boilerplate/block.json b/views/blocks/boilerplate/block.json
index d16cd92..af32025 100644
--- a/views/blocks/boilerplate/block.json
+++ b/views/blocks/boilerplate/block.json
@@ -15,9 +15,9 @@
"renderTemplate": "boilerplate.php"
},
"supports": {
- "align": false,
- "anchor": false,
- "color": false,
+ "align": true,
+ "anchor": true,
+ "color": true,
"html": false,
"jsx": false,
"mode": true,
diff --git a/views/blocks/boilerplate/boilerplate.php b/views/blocks/boilerplate/boilerplate.php
index a9bb405..fc0ec89 100644
--- a/views/blocks/boilerplate/boilerplate.php
+++ b/views/blocks/boilerplate/boilerplate.php
@@ -18,6 +18,6 @@ $classes = 'boilerplate';
$wrapper = blockWrapperAttributes( $classes, $is_preview );
?>
-