Merge branch 'main' of github.com:Vincent-Design-Inc/VDI-Starter-v5
This commit is contained in:
@@ -41,7 +41,7 @@ get_header();
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</figure>
|
</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">
|
<div class="post-list__cats">
|
||||||
Posted in:
|
Posted in:
|
||||||
<?php
|
<?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>
|
<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>
|
</a>
|
||||||
|
|
||||||
|
<div class="post-list__excerpt mb-6">
|
||||||
|
<?php customExcerpt( get_the_content(), 15 ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="post-list__byline mt-auto">
|
<div class="post-list__byline mt-auto">
|
||||||
<span class="post-list__author"><?php echo esc_html( ucfirst( get_the_author() ) ); ?> —</span>
|
<span class="post-list__author"><?php echo esc_html( ucfirst( get_the_author() ) ); ?> —</span>
|
||||||
<span class="post-list__date"><?php echo get_the_date(); ?></span>
|
<span class="post-list__date"><?php echo get_the_date(); ?></span>
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ class Enqueue {
|
|||||||
|
|
||||||
if ( file_exists( $theme_dir . $js_path ) ) {
|
if ( file_exists( $theme_dir . $js_path ) ) {
|
||||||
$version = filemtime( $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 );
|
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';
|
$admin_js_path = '/static/js/admin.js';
|
||||||
if ( file_exists( $theme_dir . $admin_js_path ) ) {
|
if ( file_exists( $theme_dir . $admin_js_path ) ) {
|
||||||
$version = filemtime( $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 );
|
wp_enqueue_script_module( 'basicwp-button', $theme_uri . '/static/js/components/button.js', array( 'basicwp-admin' ), $version, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
/** Print a variable to the console for debugging purposes.
|
||||||
*
|
*
|
||||||
* @param mixed $data The data to print to the console.
|
* @param mixed $data The data to print to the console.
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ main#maincontent {
|
|||||||
.container {
|
.container {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding-inline: clamp(1.5rem, 5vw, 3rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
.section {
|
.section {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"version": 3,
|
"version": 3,
|
||||||
"settings": {
|
"settings": {
|
||||||
"layout": {
|
"layout": {
|
||||||
"contentSize": "840px",
|
"contentSize": "100%",
|
||||||
"wideSize": "1536px"
|
"wideSize": "1536px"
|
||||||
},
|
},
|
||||||
"color": {
|
"color": {
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
"renderTemplate": "boilerplate.php"
|
"renderTemplate": "boilerplate.php"
|
||||||
},
|
},
|
||||||
"supports": {
|
"supports": {
|
||||||
"align": false,
|
"align": true,
|
||||||
"anchor": false,
|
"anchor": true,
|
||||||
"color": false,
|
"color": true,
|
||||||
"html": false,
|
"html": false,
|
||||||
"jsx": false,
|
"jsx": false,
|
||||||
"mode": true,
|
"mode": true,
|
||||||
|
|||||||
@@ -18,6 +18,6 @@ $classes = 'boilerplate';
|
|||||||
$wrapper = blockWrapperAttributes( $classes, $is_preview );
|
$wrapper = blockWrapperAttributes( $classes, $is_preview );
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<section <?php echo esc_attr( $wrapper ); ?>>
|
<section <?php echo wp_kses_post( $wrapper ); ?>>
|
||||||
<!-- Your block code will go here -->
|
<!-- Your block code will go here -->
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user