Enhance project handling for websites in portfolio
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:
Keith Solomon
2026-08-22 15:14:28 -05:00
parent d0dd9fa98a
commit 0613e33411
7 changed files with 382 additions and 264 deletions
+53
View File
@@ -139,4 +139,57 @@ class Projects {
}
return number_format( $value );
}
/**
* Whether the project is configured as a website rather than a git repo.
*
* @param int $post_id Project post ID.
* @return bool
*/
public static function is_website( int $post_id ): bool {
if ( ! self::is_plugin_active() ) {
return false;
}
return (bool) projects_portfolio_is_website( $post_id );
}
/**
* Public URL for the project's website (or empty string).
*
* @param int $post_id Project post ID.
* @return string
*/
public static function get_site_url( int $post_id ): string {
if ( ! self::is_plugin_active() ) {
return '';
}
return (string) projects_portfolio_get_site_url( $post_id );
}
/**
* Platform label for the project's website (or empty string).
*
* @param int $post_id Project post ID.
* @return string
*/
public static function get_site_platform( int $post_id ): string {
if ( ! self::is_plugin_active() ) {
return '';
}
return (string) projects_portfolio_get_site_platform( $post_id );
}
/**
* Screenshot attachment URL for the project's website (or empty string).
*
* @param int $post_id Project post ID.
* @param string $size Registered image size.
* @return string
*/
public static function get_site_screenshot_url( int $post_id, string $size = 'large' ): string {
if ( ! self::is_plugin_active() ) {
return '';
}
return (string) projects_portfolio_get_site_screenshot_url( $post_id, $size );
}
}