Enhance project handling for websites in portfolio
Sync TODOs with Issues / sync_todos (push) Successful in 6s
Sync TODOs with Issues / sync_todos (push) Successful in 6s
- Added methods in Projects class to determine if a project is a website, retrieve its URL, platform, and screenshot. - Updated single-project template to display website-specific information and actions. - Modified project card component to show website details and adjust action buttons accordingly. - Improved CSS for project cards and buttons to align with new website features.
This commit is contained in:
@@ -20,6 +20,9 @@ $type_terms = get_the_terms( $project_id, 'project-type' );
|
||||
if ( ! empty( $type_terms ) && ! is_wp_error( $type_terms ) ) {
|
||||
$type_label = strtoupper( $type_terms[0]->name );
|
||||
}
|
||||
$is_website = Projects::is_website( $project_id );
|
||||
$site_url = Projects::get_site_url( $project_id );
|
||||
$site_platform = Projects::get_site_platform( $project_id );
|
||||
$release_url = Projects::get_release_url( $project_id );
|
||||
$repo_url = Projects::get_repo_browse_url( $project_id );
|
||||
$repo_data = Projects::get_repo_data( $project_id );
|
||||
@@ -35,7 +38,7 @@ $card_classes = 'project-card group';
|
||||
<span class="project-card__type"><?php echo esc_html( $type_label ); ?></span>
|
||||
<?php endif; ?>
|
||||
<span class="project-card__provider" aria-hidden="true">
|
||||
<?php echo esc_html( Projects::get_provider_label( $project_id ) ); ?>
|
||||
<?php echo esc_html( $is_website ? __( 'Website', 'ks-portfolio' ) : Projects::get_provider_label( $project_id ) ); ?>
|
||||
</span>
|
||||
</header>
|
||||
|
||||
@@ -50,7 +53,7 @@ $card_classes = 'project-card group';
|
||||
<?php endif; ?>
|
||||
|
||||
<footer class="project-card__foot">
|
||||
<?php if ( $language || $stars > 0 ) : ?>
|
||||
<?php if ( ! $is_website && ( $language || $stars > 0 ) ) : ?>
|
||||
<div class="project-card__meta">
|
||||
<?php if ( $language ) : ?>
|
||||
<span class="project-card__lang"><?php echo esc_html( $language ); ?></span>
|
||||
@@ -59,18 +62,30 @@ $card_classes = 'project-card group';
|
||||
<span class="project-card__stars" aria-label="<?php echo esc_attr( $stars . ' stars' ); ?>">★ <?php echo esc_html( (string) $stars ); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php elseif ( $is_website && $site_platform ) : ?>
|
||||
<div class="project-card__meta">
|
||||
<span class="project-card__platform"><?php echo esc_html( $site_platform ); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="project-card__actions">
|
||||
<?php if ( $release_url ) : ?>
|
||||
<a class="project-card__action project-card__action--primary" href="<?php echo esc_url( Projects::get_download_url( $project_id ) ); ?>" rel="nofollow">
|
||||
<?php echo esc_html__( 'Download', 'ks-portfolio' ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ( $repo_url ) : ?>
|
||||
<a class="project-card__action project-card__action--secondary" href="<?php echo esc_url( $repo_url ); ?>" target="_blank" rel="noopener noreferrer">
|
||||
<?php echo esc_html__( 'View Repo', 'ks-portfolio' ); ?>
|
||||
</a>
|
||||
<?php if ( $is_website ) : ?>
|
||||
<?php if ( $site_url ) : ?>
|
||||
<a class="project-card__action project-card__action--primary" href="<?php echo esc_url( $site_url ); ?>" target="_blank" rel="noopener noreferrer">
|
||||
<?php echo esc_html__( 'Visit Site', 'ks-portfolio' ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<?php if ( $release_url ) : ?>
|
||||
<a class="project-card__action project-card__action--primary" href="<?php echo esc_url( Projects::get_download_url( $project_id ) ); ?>" rel="nofollow">
|
||||
<?php echo esc_html__( 'Download', 'ks-portfolio' ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ( $repo_url ) : ?>
|
||||
<a class="project-card__action project-card__action--secondary" href="<?php echo esc_url( $repo_url ); ?>" target="_blank" rel="noopener noreferrer">
|
||||
<?php echo esc_html__( 'View Repo', 'ks-portfolio' ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
Reference in New Issue
Block a user