Add website fields to project meta box
Adds a 'This project is a website' toggle to the Repository meta box. When checked, site fields (URL, platform, optional screenshot) replace the git-repo fields; when unchecked, repo fields are shown and site fields are cleared. Existing posts default to repo mode. - admin/metabox.php: checkbox, site URL/platform/screenshot inputs with media-library picker, JS toggle, save handler that switches modes - includes/helper-functions.php: projects_portfolio_is_website / get _site_url / get_site_platform / get_site_screenshot_url helpers - templates/single-projects.php: website-mode rendering (Visit Site button, platform row, screenshot) - tests/test-metabox.php: website-mode persistence + mode-switch tests - tests/wp-stubs.php: sanitize_text_field, absint stubs
This commit is contained in:
@@ -80,6 +80,12 @@ if ( ! function_exists( 'wp_unslash' ) ) {
|
||||
if ( ! function_exists( 'esc_url_raw' ) ) {
|
||||
function esc_url_raw( $url ) { return $url; }
|
||||
}
|
||||
if ( ! function_exists( 'sanitize_text_field' ) ) {
|
||||
function sanitize_text_field( $str ) { return is_string( $str ) ? trim( $str ) : ''; }
|
||||
}
|
||||
if ( ! function_exists( 'absint' ) ) {
|
||||
function absint( $maybeint ) { return abs( (int) $maybeint ); }
|
||||
}
|
||||
|
||||
// Minimal WP_Error stub if Brain\Monkey doesn't supply one.
|
||||
if ( ! class_exists( 'WP_Error' ) ) {
|
||||
|
||||
Reference in New Issue
Block a user