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:
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user