This commit is contained in:
@@ -300,25 +300,6 @@
|
|||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-hero { min-height: 60vh; display: flex; align-items: center; padding: 4rem 0; }
|
|
||||||
.home-hero__inner { max-width: 50rem; }
|
|
||||||
.home-hero__heading {
|
|
||||||
font-family: var(--font-sans);
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: clamp(2rem, 4vw, 3.5rem);
|
|
||||||
line-height: 1.1;
|
|
||||||
color: var(--color-on-surface, #e3e1e9);
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
}
|
|
||||||
.home-hero__intro {
|
|
||||||
color: var(--color-on-surface-variant, #c5c5d3);
|
|
||||||
font-size: clamp(1rem, 1.5vw, 1.25rem);
|
|
||||||
line-height: 1.6;
|
|
||||||
max-width: 50ch;
|
|
||||||
margin: 0 0 1.5rem;
|
|
||||||
}
|
|
||||||
.home-hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
|
|
||||||
|
|
||||||
.home-recent__head {
|
.home-recent__head {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "acf/recent-projects",
|
||||||
|
"title": "Recent Projects",
|
||||||
|
"description": "Block to display recent projects on the home page.",
|
||||||
|
"style": [
|
||||||
|
"file:./recent-projects.css"
|
||||||
|
],
|
||||||
|
"category": "sf-blocks",
|
||||||
|
"icon": "block-default",
|
||||||
|
"keywords": [
|
||||||
|
"recent-projects"
|
||||||
|
],
|
||||||
|
"acf": {
|
||||||
|
"mode": "preview",
|
||||||
|
"renderTemplate": "recent-projects.php"
|
||||||
|
},
|
||||||
|
"supports": {
|
||||||
|
"align": true,
|
||||||
|
"anchor": true,
|
||||||
|
"color": true,
|
||||||
|
"html": false,
|
||||||
|
"jsx": false,
|
||||||
|
"mode": true,
|
||||||
|
"multiple": false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Block Name: Recent Projects
|
||||||
|
|
||||||
|
* Block to display recent projects on the home page.
|
||||||
|
*
|
||||||
|
* @package KsPortfolio
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace KsPortfolio;
|
||||||
|
|
||||||
|
$classes = 'home-recent container mx-auto my-section';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: DO NOT remove this function call - it is required to avoid editor issues.
|
||||||
|
* $is_preview is a WordPress global when in the editor.
|
||||||
|
*/
|
||||||
|
$wrapper = blockWrapperAttributes( $classes, $is_preview );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<section <?php echo wp_kses_post( $wrapper ); ?>>
|
||||||
|
<header class="home-recent__head">
|
||||||
|
<h2 class="home-recent__title"><?php echo esc_html__( 'Recent Projects', 'ks-portfolio' ); ?></h2>
|
||||||
|
<a class="home-recent__view-all" href="<?php echo esc_url( get_post_type_archive_link( 'projects' ) ); ?>">
|
||||||
|
<?php echo esc_html__( 'View All', 'ks-portfolio' ); ?> →
|
||||||
|
</a>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<hr class="home-recent__divider" />
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$recent = new \WP_Query(
|
||||||
|
array(
|
||||||
|
'post_type' => 'projects',
|
||||||
|
'posts_per_page' => 3,
|
||||||
|
'no_found_rows' => true,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( $recent->have_posts() ) :
|
||||||
|
?>
|
||||||
|
<div class="home-recent__grid grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
|
<?php
|
||||||
|
while ( $recent->have_posts() ) :
|
||||||
|
$recent->the_post();
|
||||||
|
get_template_part( 'views/components/project-card' );
|
||||||
|
endwhile;
|
||||||
|
wp_reset_postdata();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php else : ?>
|
||||||
|
<div class="home-recent__empty">
|
||||||
|
<h3><?php echo esc_html__( 'Nothing here yet…', 'ks-portfolio' ); ?></h3>
|
||||||
|
<p><?php echo esc_html__( 'No published projects found.', 'ks-portfolio' ); ?></p>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</section>
|
||||||
Reference in New Issue
Block a user