Skip to content

Commit

Permalink
Swap in recent P J Reports for outdated Tech Radars in menu
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Abraham <[email protected]>
  • Loading branch information
cjyabraham committed Aug 20, 2024
1 parent 1ffc335 commit 09a8d45
Showing 1 changed file with 26 additions and 62 deletions.
88 changes: 26 additions & 62 deletions web/wp-content/themes/cncf-twenty-two/components/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,74 +153,38 @@
</div>
<div class="col3">
<ul class="menu">
<li class="lf-menu-title">Latest Tech Radars
<li class="lf-menu-title">Latest Project Journey Reports
</li>
</ul>

<?php
// Get all radars.
$tech_radars_all = LF_utils::get_tech_radars();

if ( is_array( $tech_radars_all ) ) :

$tech_radars = array_slice( $tech_radars_all, 0, 3 );
?>
<div class="columns-one">
<?php
foreach ( $tech_radars as $tech_radar ) :

$url = 'https://radar.cncf.io/' . $tech_radar->key;
$radar_title = $tech_radar->name;
$date = $tech_radar->date;
$image = $tech_radar->image;
?>

<div class="main-menu-item radar-menu-item">
<div
class="main-menu-item__image-wrapper">

<a href="<?php echo esc_url( $url ); ?>"
title="<?php echo esc_html( $radar_title ); ?>"
class="main-menu-item__link">

<?php
if ( $image ) {
?>
<img src="<?php echo esc_url( $image ); ?>"
alt="<?php echo esc_html( $radar_title ); ?>"
class="main-menu-item__image"
loading="lazy">
<?php
} else {
// show generic.
Lf_Utils::display_responsive_images( $site_options['generic_thumb_id'], 'newsroom-388', '400px', 'main-menu-item__image' );
}
?>
</a>
</div>
<div
class="main-menu-item__text-wrapper">

<a class="author-category"
title="See more tech radars"
href="https://radar.cncf.io/">Tech
Radar</a>

<span class="main-menu-item__title">
<a href="<?php echo esc_url( $url ); ?>"
title="<?php echo esc_html( $radar_title ); ?>"><?php echo esc_html( $radar_title ); ?></a>
</span>
<span
class="main-menu-item__date"><?php echo esc_html( $date ); ?></span>
</div>
</div>
<?php
endforeach;
$pj_reports = array(
'post_type' => 'lf_report',
'post_status' => array( 'publish' ),
'posts_per_page' => 3,
'orderby' => 'date',
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'lf-report-type',
'field' => 'slug',
'terms' => 'project-journey',
),
),
);

$query = new WP_Query( $pj_reports );

if ( $query->have_posts() ) :
while ( $query->have_posts() ) :
$query->the_post();
get_template_part( 'components/main-menu-item' );
endwhile;
endif;
wp_reset_postdata();
?>
</div>
<?php
endif;
?>

</div>
</div>
</div>
Expand Down

0 comments on commit 09a8d45

Please sign in to comment.