Merge branch 'main' of github.com:Vincent-Design-Inc/VDI-Starter-v5

This commit is contained in:
Keith Solomon
2026-01-26 08:53:50 -06:00
7 changed files with 59 additions and 8 deletions

View File

@@ -41,7 +41,7 @@ get_header();
<?php endif; ?>
</figure>
<div class="post-list__details px-4 py-8 flex flex-col flex-grow">
<div class="post-list__details px-4 py-8 flex flex-col grow">
<div class="post-list__cats">
Posted in:
<?php
@@ -57,6 +57,10 @@ get_header();
<h2 class="post-list__title font-normal text-25px text-balance line-clamp-4 truncate mt-0 mb-5 mx-0"><?php the_title(); ?></h2>
</a>
<div class="post-list__excerpt mb-6">
<?php customExcerpt( get_the_content(), 15 ); ?>
</div>
<div class="post-list__byline mt-auto">
<span class="post-list__author"><?php echo esc_html( ucfirst( get_the_author() ) ); ?> &mdash;</span>
<span class="post-list__date"><?php echo get_the_date(); ?></span>

View File

@@ -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 );
}
}

View File

@@ -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.

View File

@@ -32,6 +32,7 @@ main#maincontent {
.container {
margin: 0 auto;
width: 100%;
padding-inline: clamp(1.5rem, 5vw, 3rem);
}
.section {

View File

@@ -3,7 +3,7 @@
"version": 3,
"settings": {
"layout": {
"contentSize": "840px",
"contentSize": "100%",
"wideSize": "1536px"
},
"color": {

View File

@@ -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,

View File

@@ -18,6 +18,6 @@ $classes = 'boilerplate';
$wrapper = blockWrapperAttributes( $classes, $is_preview );
?>
<section <?php echo esc_attr( $wrapper ); ?>>
<section <?php echo wp_kses_post( $wrapper ); ?>>
<!-- Your block code will go here -->
</section>