From 3d3cac69c96732ac0d4df9e1b240b3352cd2eb64 Mon Sep 17 00:00:00 2001 From: Ben Keith Date: Fri, 15 May 2020 16:53:06 -0400 Subject: [PATCH 1/7] Create the current-ltw-projects plugin shell --- .../plugins/current-ltw-projects/.distignore | 41 ++++++++++++++ .../current-ltw-projects/.editorconfig | 22 ++++++++ .../plugins/current-ltw-projects/.gitignore | 9 +++ .../plugins/current-ltw-projects/Gruntfile.js | 56 +++++++++++++++++++ .../current-ltw-projects.php | 15 +++++ .../plugins/current-ltw-projects/package.json | 11 ++++ .../plugins/current-ltw-projects/readme.txt | 42 ++++++++++++++ 7 files changed, 196 insertions(+) create mode 100755 wp-content/plugins/current-ltw-projects/.distignore create mode 100755 wp-content/plugins/current-ltw-projects/.editorconfig create mode 100755 wp-content/plugins/current-ltw-projects/.gitignore create mode 100755 wp-content/plugins/current-ltw-projects/Gruntfile.js create mode 100755 wp-content/plugins/current-ltw-projects/current-ltw-projects.php create mode 100755 wp-content/plugins/current-ltw-projects/package.json create mode 100755 wp-content/plugins/current-ltw-projects/readme.txt diff --git a/wp-content/plugins/current-ltw-projects/.distignore b/wp-content/plugins/current-ltw-projects/.distignore new file mode 100755 index 0000000..a2c3490 --- /dev/null +++ b/wp-content/plugins/current-ltw-projects/.distignore @@ -0,0 +1,41 @@ +# A set of files you probably don't want in your WordPress.org distribution +.babelrc +.deployignore +.distignore +.editorconfig +.eslintignore +.eslintrc +.git +.gitignore +.gitlab-ci.yml +.travis.yml +.DS_Store +Thumbs.db +behat.yml +bitbucket-pipelines.yml +bin +.circleci/config.yml +composer.json +composer.lock +dependencies.yml +Gruntfile.js +package.json +package-lock.json +phpunit.xml +phpunit.xml.dist +multisite.xml +multisite.xml.dist +.phpcs.xml +phpcs.xml +.phpcs.xml.dist +phpcs.xml.dist +README.md +webpack.config.js +wp-cli.local.yml +yarn.lock +tests +vendor +node_modules +*.sql +*.tar.gz +*.zip diff --git a/wp-content/plugins/current-ltw-projects/.editorconfig b/wp-content/plugins/current-ltw-projects/.editorconfig new file mode 100755 index 0000000..79207a4 --- /dev/null +++ b/wp-content/plugins/current-ltw-projects/.editorconfig @@ -0,0 +1,22 @@ +# This file is for unifying the coding style for different editors and IDEs +# editorconfig.org + +# WordPress Coding Standards +# https://make.wordpress.org/core/handbook/coding-standards/ + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = tab +indent_size = 4 + +[{.jshintrc,*.json,*.yml}] +indent_style = space +indent_size = 2 + +[{*.txt,wp-config-sample.php}] +end_of_line = crlf diff --git a/wp-content/plugins/current-ltw-projects/.gitignore b/wp-content/plugins/current-ltw-projects/.gitignore new file mode 100755 index 0000000..6f68bc7 --- /dev/null +++ b/wp-content/plugins/current-ltw-projects/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +phpcs.xml +phpunit.xml +Thumbs.db +wp-cli.local.yml +node_modules/ +*.sql +*.tar.gz +*.zip diff --git a/wp-content/plugins/current-ltw-projects/Gruntfile.js b/wp-content/plugins/current-ltw-projects/Gruntfile.js new file mode 100755 index 0000000..5c3390f --- /dev/null +++ b/wp-content/plugins/current-ltw-projects/Gruntfile.js @@ -0,0 +1,56 @@ +module.exports = function( grunt ) { + + 'use strict'; + + // Project configuration + grunt.initConfig( { + + pkg: grunt.file.readJSON( 'package.json' ), + + addtextdomain: { + options: { + textdomain: 'current-ltw-projects', + }, + update_all_domains: { + options: { + updateDomains: true + }, + src: [ '*.php', '**/*.php', '!\.git/**/*', '!bin/**/*', '!node_modules/**/*', '!tests/**/*' ] + } + }, + + wp_readme_to_markdown: { + your_target: { + files: { + 'README.md': 'readme.txt' + } + }, + }, + + makepot: { + target: { + options: { + domainPath: '/languages', + exclude: [ '\.git/*', 'bin/*', 'node_modules/*', 'tests/*' ], + mainFile: 'current-ltw-projects.php', + potFilename: 'current-ltw-projects.pot', + potHeaders: { + poedit: true, + 'x-poedit-keywordslist': true + }, + type: 'wp-plugin', + updateTimestamp: true + } + } + }, + } ); + + grunt.loadNpmTasks( 'grunt-wp-i18n' ); + grunt.loadNpmTasks( 'grunt-wp-readme-to-markdown' ); + grunt.registerTask( 'default', [ 'i18n','readme' ] ); + grunt.registerTask( 'i18n', ['addtextdomain', 'makepot'] ); + grunt.registerTask( 'readme', ['wp_readme_to_markdown'] ); + + grunt.util.linefeed = '\n'; + +}; diff --git a/wp-content/plugins/current-ltw-projects/current-ltw-projects.php b/wp-content/plugins/current-ltw-projects/current-ltw-projects.php new file mode 100755 index 0000000..efe67b6 --- /dev/null +++ b/wp-content/plugins/current-ltw-projects/current-ltw-projects.php @@ -0,0 +1,15 @@ + Date: Fri, 15 May 2020 17:15:56 -0400 Subject: [PATCH 2/7] Add projects post type scaffolding --- .gitignore | 1 + .../plugins/current-ltw-projects/.gitignore | 1 + .../post-types/projects.php | 87 +++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100755 wp-content/plugins/current-ltw-projects/post-types/projects.php diff --git a/.gitignore b/.gitignore index d17a9d4..dd1d2c8 100644 --- a/.gitignore +++ b/.gitignore @@ -119,3 +119,4 @@ wp-content/debug.log # add a line here that looks like this: # !/wp-content/themes/currentorg !/wp-content/themes/currentorg +!/wp-content/plugins/current-ltw-projects diff --git a/wp-content/plugins/current-ltw-projects/.gitignore b/wp-content/plugins/current-ltw-projects/.gitignore index 6f68bc7..9181160 100755 --- a/wp-content/plugins/current-ltw-projects/.gitignore +++ b/wp-content/plugins/current-ltw-projects/.gitignore @@ -3,6 +3,7 @@ phpcs.xml phpunit.xml Thumbs.db wp-cli.local.yml +package-lock.json node_modules/ *.sql *.tar.gz diff --git a/wp-content/plugins/current-ltw-projects/post-types/projects.php b/wp-content/plugins/current-ltw-projects/post-types/projects.php new file mode 100755 index 0000000..ab6cd69 --- /dev/null +++ b/wp-content/plugins/current-ltw-projects/post-types/projects.php @@ -0,0 +1,87 @@ + array( + 'name' => __( 'Projects', 'current-ltw-projects' ), + 'singular_name' => __( 'Project', 'current-ltw-projects' ), + 'all_items' => __( 'All Projects', 'current-ltw-projects' ), + 'archives' => __( 'Project Archives', 'current-ltw-projects' ), + 'attributes' => __( 'Project Attributes', 'current-ltw-projects' ), + 'insert_into_item' => __( 'Insert into Project', 'current-ltw-projects' ), + 'uploaded_to_this_item' => __( 'Uploaded to this Project', 'current-ltw-projects' ), + 'featured_image' => _x( 'Featured Image', 'projects', 'current-ltw-projects' ), + 'set_featured_image' => _x( 'Set featured image', 'projects', 'current-ltw-projects' ), + 'remove_featured_image' => _x( 'Remove featured image', 'projects', 'current-ltw-projects' ), + 'use_featured_image' => _x( 'Use as featured image', 'projects', 'current-ltw-projects' ), + 'filter_items_list' => __( 'Filter Projects list', 'current-ltw-projects' ), + 'items_list_navigation' => __( 'Projects list navigation', 'current-ltw-projects' ), + 'items_list' => __( 'Projects list', 'current-ltw-projects' ), + 'new_item' => __( 'New Project', 'current-ltw-projects' ), + 'add_new' => __( 'Add New', 'current-ltw-projects' ), + 'add_new_item' => __( 'Add New Project', 'current-ltw-projects' ), + 'edit_item' => __( 'Edit Project', 'current-ltw-projects' ), + 'view_item' => __( 'View Project', 'current-ltw-projects' ), + 'view_items' => __( 'View Projects', 'current-ltw-projects' ), + 'search_items' => __( 'Search Projects', 'current-ltw-projects' ), + 'not_found' => __( 'No Projects found', 'current-ltw-projects' ), + 'not_found_in_trash' => __( 'No Projects found in trash', 'current-ltw-projects' ), + 'parent_item_colon' => __( 'Parent Project:', 'current-ltw-projects' ), + 'menu_name' => __( 'Projects', 'current-ltw-projects' ), + ), + 'public' => true, + 'hierarchical' => false, + 'show_ui' => true, + 'show_in_nav_menus' => true, + 'supports' => array( 'title', 'editor' ), + 'has_archive' => true, + 'rewrite' => true, + 'query_var' => true, + 'menu_position' => null, + 'menu_icon' => 'dashicons-awards', + 'show_in_rest' => true, + 'rest_base' => 'projects', + 'rest_controller_class' => 'WP_REST_Posts_Controller', + ) ); + +} +add_action( 'init', 'projects_init' ); + +/** + * Sets the post updated messages for the `projects` post type. + * + * @param array $messages Post updated messages. + * @return array Messages for the `projects` post type. + */ +function projects_updated_messages( $messages ) { + global $post; + + $permalink = get_permalink( $post ); + + $messages['projects'] = array( + 0 => '', // Unused. Messages start at index 1. + /* translators: %s: post permalink */ + 1 => sprintf( __( 'Project updated. View Project', 'current-ltw-projects' ), esc_url( $permalink ) ), + 2 => __( 'Custom field updated.', 'current-ltw-projects' ), + 3 => __( 'Custom field deleted.', 'current-ltw-projects' ), + 4 => __( 'Project updated.', 'current-ltw-projects' ), + /* translators: %s: date and time of the revision */ + 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Project restored to revision from %s', 'current-ltw-projects' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, + /* translators: %s: post permalink */ + 6 => sprintf( __( 'Project published. View Project', 'current-ltw-projects' ), esc_url( $permalink ) ), + 7 => __( 'Project saved.', 'current-ltw-projects' ), + /* translators: %s: post permalink */ + 8 => sprintf( __( 'Project submitted. Preview Project', 'current-ltw-projects' ), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ), + /* translators: 1: Publish box date format, see https://secure.php.net/date 2: Post permalink */ + 9 => sprintf( __( 'Project scheduled for: %1$s. Preview Project', 'current-ltw-projects' ), + date_i18n( __( 'M j, Y @ G:i', 'current-ltw-projects' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ), + /* translators: %s: post permalink */ + 10 => sprintf( __( 'Project draft updated. Preview Project', 'current-ltw-projects' ), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ), + ); + + return $messages; +} +add_filter( 'post_updated_messages', 'projects_updated_messages' ); From fbd0a49b231a939f8f5330e05421a2b384c225f8 Mon Sep 17 00:00:00 2001 From: Ben Keith Date: Fri, 15 May 2020 19:59:31 -0400 Subject: [PATCH 3/7] include the post type file --- .../current-ltw-projects/current-ltw-projects.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-content/plugins/current-ltw-projects/current-ltw-projects.php b/wp-content/plugins/current-ltw-projects/current-ltw-projects.php index efe67b6..96981fa 100755 --- a/wp-content/plugins/current-ltw-projects/current-ltw-projects.php +++ b/wp-content/plugins/current-ltw-projects/current-ltw-projects.php @@ -12,4 +12,11 @@ * @package Current_Ltw_Projects */ -// Your code starts here. +$includes = array( + '/post-types/projects.php', +); +foreach ( $includes as $include ) { + if ( 0 === validate_file( $include ) ) { + require_once( dirname( __FILE__ ) . $include ); + } +} From 36b229e0fdd594a0b5b7562d19d7400ef7090940 Mon Sep 17 00:00:00 2001 From: Ben Keith Date: Fri, 15 May 2020 19:59:47 -0400 Subject: [PATCH 4/7] Post meta fields registration, some labels --- .../post-types/projects.php | 79 +++++++++++++++++-- 1 file changed, 72 insertions(+), 7 deletions(-) diff --git a/wp-content/plugins/current-ltw-projects/post-types/projects.php b/wp-content/plugins/current-ltw-projects/post-types/projects.php index ab6cd69..c3d4c54 100755 --- a/wp-content/plugins/current-ltw-projects/post-types/projects.php +++ b/wp-content/plugins/current-ltw-projects/post-types/projects.php @@ -1,4 +1,7 @@ array( - 'name' => __( 'Projects', 'current-ltw-projects' ), + 'name' => __( 'Local That Works Projects', 'current-ltw-projects' ), 'singular_name' => __( 'Project', 'current-ltw-projects' ), - 'all_items' => __( 'All Projects', 'current-ltw-projects' ), - 'archives' => __( 'Project Archives', 'current-ltw-projects' ), - 'attributes' => __( 'Project Attributes', 'current-ltw-projects' ), + 'all_items' => __( 'All LTW Projects', 'current-ltw-projects' ), + 'archives' => __( 'LTW Project Archives', 'current-ltw-projects' ), + 'attributes' => __( 'LTW Project Attributes', 'current-ltw-projects' ), 'insert_into_item' => __( 'Insert into Project', 'current-ltw-projects' ), 'uploaded_to_this_item' => __( 'Uploaded to this Project', 'current-ltw-projects' ), - 'featured_image' => _x( 'Featured Image', 'projects', 'current-ltw-projects' ), + 'featured_image' => _x( 'Project Featured Image', 'projects', 'current-ltw-projects' ), 'set_featured_image' => _x( 'Set featured image', 'projects', 'current-ltw-projects' ), 'remove_featured_image' => _x( 'Remove featured image', 'projects', 'current-ltw-projects' ), 'use_featured_image' => _x( 'Use as featured image', 'projects', 'current-ltw-projects' ), @@ -25,8 +28,8 @@ function projects_init() { 'add_new_item' => __( 'Add New Project', 'current-ltw-projects' ), 'edit_item' => __( 'Edit Project', 'current-ltw-projects' ), 'view_item' => __( 'View Project', 'current-ltw-projects' ), - 'view_items' => __( 'View Projects', 'current-ltw-projects' ), - 'search_items' => __( 'Search Projects', 'current-ltw-projects' ), + 'view_items' => __( 'View LTW Projects', 'current-ltw-projects' ), + 'search_items' => __( 'Search LTW Projects', 'current-ltw-projects' ), 'not_found' => __( 'No Projects found', 'current-ltw-projects' ), 'not_found_in_trash' => __( 'No Projects found in trash', 'current-ltw-projects' ), 'parent_item_colon' => __( 'Parent Project:', 'current-ltw-projects' ), @@ -85,3 +88,65 @@ function projects_updated_messages( $messages ) { return $messages; } add_filter( 'post_updated_messages', 'projects_updated_messages' ); + +/** + * Register the custom post meta for Local That Works projects + * + * @link https://developer.wordpress.org/reference/functions/register_meta/ + * @link https://developer.wordpress.org/block-editor/tutorials/plugin-sidebar-0/ + */ +function projects_register_post_meta() { + register_post_meta( + 'projects', + 'project-contact-name', + array( + 'object_subtype' => 'post', + 'type' => 'string', + 'description' => 'The contact human for this project.', + 'single' => true, + 'sanitize_callback' => 'sanitize_text_field', + // 'auth_callback' => .... I don't know the answer to this question. + 'show_in_rest' => true, + ) + ); + register_post_meta( + 'projects', + 'project-contact-email', + array( + 'object_subtype' => 'post', + 'type' => 'string', + 'description' => 'The contact email for this project.', + 'single' => true, + 'sanitize_callback' => 'sanitize_text_field', + // 'auth_callback' => .... I don't know the answer to this question. + 'show_in_rest' => true, + ) + ); + register_post_meta( + 'projects', + 'project-organization', + array( + 'object_subtype' => 'post', + 'type' => 'string', + 'description' => 'The organization responsible for this project.', + 'single' => true, + 'sanitize_callback' => 'sanitize_text_field', + // 'auth_callback' => .... I don't know the answer to this question. + 'show_in_rest' => true, + ) + ); + register_post_meta( + 'projects', + 'project-video', + array( + 'object_subtype' => 'post', + 'type' => 'string', + 'description' => 'Link to video URL for this project', + 'single' => true, + 'sanitize_callback' => 'esc_url_raw', + // 'auth_callback' => .... I don't know the answer to this question. + 'show_in_rest' => true, + ) + ); +} +add_action( 'init', 'projects_register_post_meta' ); From de24c5b4af4c787f40dc2e2813aa5762c580cda6 Mon Sep 17 00:00:00 2001 From: Ben Keith Date: Mon, 18 May 2020 14:14:15 -0400 Subject: [PATCH 5/7] Set the LTW Projects archive slug to 'local-that-works' --- wp-content/plugins/current-ltw-projects/post-types/projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-content/plugins/current-ltw-projects/post-types/projects.php b/wp-content/plugins/current-ltw-projects/post-types/projects.php index c3d4c54..bd88d4a 100755 --- a/wp-content/plugins/current-ltw-projects/post-types/projects.php +++ b/wp-content/plugins/current-ltw-projects/post-types/projects.php @@ -41,7 +41,7 @@ function projects_init() { 'show_in_nav_menus' => true, 'supports' => array( 'title', 'editor' ), 'has_archive' => true, - 'rewrite' => true, + 'rewrite' => array( 'slug' => 'local-that-works' ), 'query_var' => true, 'menu_position' => null, 'menu_icon' => 'dashicons-awards', From 8c793d7a2401eec902c1f1bdb08734705e4c3bfc Mon Sep 17 00:00:00 2001 From: Ben Keith Date: Mon, 18 May 2020 17:20:50 -0400 Subject: [PATCH 6/7] Create custom taxonomies for these terms. --- .../current-ltw-projects.php | 3 + .../taxonomies/project-category.php | 74 +++++++++++++++++++ .../taxonomies/project-org-type.php | 74 +++++++++++++++++++ .../taxonomies/project-status.php | 74 +++++++++++++++++++ 4 files changed, 225 insertions(+) create mode 100755 wp-content/plugins/current-ltw-projects/taxonomies/project-category.php create mode 100755 wp-content/plugins/current-ltw-projects/taxonomies/project-org-type.php create mode 100755 wp-content/plugins/current-ltw-projects/taxonomies/project-status.php diff --git a/wp-content/plugins/current-ltw-projects/current-ltw-projects.php b/wp-content/plugins/current-ltw-projects/current-ltw-projects.php index 96981fa..a258dfa 100755 --- a/wp-content/plugins/current-ltw-projects/current-ltw-projects.php +++ b/wp-content/plugins/current-ltw-projects/current-ltw-projects.php @@ -14,6 +14,9 @@ $includes = array( '/post-types/projects.php', + '/taxonomies/project-status.php', + '/taxonomies/project-org-type.php', + '/taxonomies/project-category.php', ); foreach ( $includes as $include ) { if ( 0 === validate_file( $include ) ) { diff --git a/wp-content/plugins/current-ltw-projects/taxonomies/project-category.php b/wp-content/plugins/current-ltw-projects/taxonomies/project-category.php new file mode 100755 index 0000000..beb6a0d --- /dev/null +++ b/wp-content/plugins/current-ltw-projects/taxonomies/project-category.php @@ -0,0 +1,74 @@ + true, + 'public' => true, + 'show_in_nav_menus' => true, + 'show_ui' => true, + 'show_admin_column' => false, + 'query_var' => true, + 'rewrite' => true, + 'capabilities' => array( + 'manage_terms' => 'edit_posts', + 'edit_terms' => 'edit_posts', + 'delete_terms' => 'edit_posts', + 'assign_terms' => 'edit_posts', + ), + 'labels' => array( + 'name' => __( 'Content Categories', 'current-ltw-projects' ), + 'singular_name' => _x( 'Content Category', 'taxonomy general name', 'current-ltw-projects' ), + 'search_items' => __( 'Search Content Categories', 'current-ltw-projects' ), + 'popular_items' => __( 'Popular Content Categories', 'current-ltw-projects' ), + 'all_items' => __( 'All Content Categories', 'current-ltw-projects' ), + 'parent_item' => __( 'Parent Content Category', 'current-ltw-projects' ), + 'parent_item_colon' => __( 'Parent Content Category:', 'current-ltw-projects' ), + 'edit_item' => __( 'Edit Content Category', 'current-ltw-projects' ), + 'update_item' => __( 'Update Content Category', 'current-ltw-projects' ), + 'view_item' => __( 'View Content Category', 'current-ltw-projects' ), + 'add_new_item' => __( 'Add New Content Category', 'current-ltw-projects' ), + 'new_item_name' => __( 'New Content Category', 'current-ltw-projects' ), + 'separate_items_with_commas' => __( 'Separate Content Categories with commas', 'current-ltw-projects' ), + 'add_or_remove_items' => __( 'Add or remove Content Categories', 'current-ltw-projects' ), + 'choose_from_most_used' => __( 'Choose from the most used Content Categories', 'current-ltw-projects' ), + 'not_found' => __( 'No Content Category found.', 'current-ltw-projects' ), + 'no_terms' => __( 'No Content Category', 'current-ltw-projects' ), + 'menu_name' => __( 'Content Categories', 'current-ltw-projects' ), + 'items_list_navigation' => __( 'Content Categories list navigation', 'current-ltw-projects' ), + 'items_list' => __( 'Content Categories list', 'current-ltw-projects' ), + 'most_used' => _x( 'Most Used', 'ltw-content-categories', 'current-ltw-projects' ), + 'back_to_items' => __( '← Back to Content Categories', 'current-ltw-projects' ), + ), + 'show_in_rest' => true, + 'rest_base' => 'project-category', + 'rest_controller_class' => 'WP_REST_Terms_Controller', + ) ); + +} +add_action( 'init', 'ltw_content_categories_init' ); + +/** + * Sets the post updated messages for the `ltw_content_categories` taxonomy. + * + * @param array $messages Post updated messages. + * @return array Messages for the `ltw_content_categories` taxonomy. + */ +function ltw_content_categories_updated_messages( $messages ) { + + $messages['project-category'] = array( + 0 => '', // Unused. Messages start at index 1. + 1 => __( 'Content Category added.', 'current-ltw-projects' ), + 2 => __( 'Content Category deleted.', 'current-ltw-projects' ), + 3 => __( 'Content Category updated.', 'current-ltw-projects' ), + 4 => __( 'Content Category not added.', 'current-ltw-projects' ), + 5 => __( 'Content Category not updated.', 'current-ltw-projects' ), + 6 => __( 'Content Category deleted.', 'current-ltw-projects' ), + ); + + return $messages; +} +add_filter( 'term_updated_messages', 'ltw_content_categories_updated_messages' ); diff --git a/wp-content/plugins/current-ltw-projects/taxonomies/project-org-type.php b/wp-content/plugins/current-ltw-projects/taxonomies/project-org-type.php new file mode 100755 index 0000000..efa01eb --- /dev/null +++ b/wp-content/plugins/current-ltw-projects/taxonomies/project-org-type.php @@ -0,0 +1,74 @@ + true, + 'public' => true, + 'show_in_nav_menus' => true, + 'show_ui' => true, + 'show_admin_column' => false, + 'query_var' => true, + 'rewrite' => true, + 'capabilities' => array( + 'manage_terms' => 'edit_posts', + 'edit_terms' => 'edit_posts', + 'delete_terms' => 'edit_posts', + 'assign_terms' => 'edit_posts', + ), + 'labels' => array( + 'name' => __( 'Organization Types', 'current-ltw-projects' ), + 'singular_name' => _x( 'Organization Type', 'taxonomy general name', 'current-ltw-projects' ), + 'search_items' => __( 'Search Organization Types', 'current-ltw-projects' ), + 'popular_items' => __( 'Popular Organization Types', 'current-ltw-projects' ), + 'all_items' => __( 'All Organization Types', 'current-ltw-projects' ), + 'parent_item' => __( 'Parent Organization Type', 'current-ltw-projects' ), + 'parent_item_colon' => __( 'Parent Organization Type:', 'current-ltw-projects' ), + 'edit_item' => __( 'Edit Organization Type', 'current-ltw-projects' ), + 'update_item' => __( 'Update Organization Type', 'current-ltw-projects' ), + 'view_item' => __( 'View Organization Type', 'current-ltw-projects' ), + 'add_new_item' => __( 'Add New Organization Type', 'current-ltw-projects' ), + 'new_item_name' => __( 'New Organization Type', 'current-ltw-projects' ), + 'separate_items_with_commas' => __( 'Separate Organization Types with commas', 'current-ltw-projects' ), + 'add_or_remove_items' => __( 'Add or remove Organization Types', 'current-ltw-projects' ), + 'choose_from_most_used' => __( 'Choose from the most used Organization Types', 'current-ltw-projects' ), + 'not_found' => __( 'No Organization Types found.', 'current-ltw-projects' ), + 'no_terms' => __( 'No Organization Types', 'current-ltw-projects' ), + 'menu_name' => __( 'Organization Types', 'current-ltw-projects' ), + 'items_list_navigation' => __( 'Organization Types list navigation', 'current-ltw-projects' ), + 'items_list' => __( 'Organization Types list', 'current-ltw-projects' ), + 'most_used' => _x( 'Most Used', 'project-org-type', 'current-ltw-projects' ), + 'back_to_items' => __( '← Back to Organization Types', 'current-ltw-projects' ), + ), + 'show_in_rest' => true, + 'rest_base' => 'project-org-type', + 'rest_controller_class' => 'WP_REST_Terms_Controller', + ) ); + +} +add_action( 'init', 'project_org_type_init' ); + +/** + * Sets the post updated messages for the `project_org_type` taxonomy. + * + * @param array $messages Post updated messages. + * @return array Messages for the `project_org_type` taxonomy. + */ +function project_org_type_updated_messages( $messages ) { + + $messages['project-org-type'] = array( + 0 => '', // Unused. Messages start at index 1. + 1 => __( 'Organization Type added.', 'current-ltw-projects' ), + 2 => __( 'Organization Type deleted.', 'current-ltw-projects' ), + 3 => __( 'Organization Type updated.', 'current-ltw-projects' ), + 4 => __( 'Organization Type not added.', 'current-ltw-projects' ), + 5 => __( 'Organization Type not updated.', 'current-ltw-projects' ), + 6 => __( 'Organization Types deleted.', 'current-ltw-projects' ), + ); + + return $messages; +} +add_filter( 'term_updated_messages', 'project_org_type_updated_messages' ); diff --git a/wp-content/plugins/current-ltw-projects/taxonomies/project-status.php b/wp-content/plugins/current-ltw-projects/taxonomies/project-status.php new file mode 100755 index 0000000..cf4352b --- /dev/null +++ b/wp-content/plugins/current-ltw-projects/taxonomies/project-status.php @@ -0,0 +1,74 @@ + true, + 'public' => true, + 'show_in_nav_menus' => true, + 'show_ui' => true, + 'show_admin_column' => false, + 'query_var' => true, + 'rewrite' => true, + 'capabilities' => array( + 'manage_terms' => 'edit_posts', + 'edit_terms' => 'edit_posts', + 'delete_terms' => 'edit_posts', + 'assign_terms' => 'edit_posts', + ), + 'labels' => array( + 'name' => __( 'Status', 'current-ltw-projects' ), + 'singular_name' => _x( 'Status', 'taxonomy general name', 'current-ltw-projects' ), + 'search_items' => __( 'Search Statuses', 'current-ltw-projects' ), + 'popular_items' => __( 'Popular Statuses', 'current-ltw-projects' ), + 'all_items' => __( 'All Statuses', 'current-ltw-projects' ), + 'parent_item' => __( 'Parent Status', 'current-ltw-projects' ), + 'parent_item_colon' => __( 'Parent Status:', 'current-ltw-projects' ), + 'edit_item' => __( 'Edit Status', 'current-ltw-projects' ), + 'update_item' => __( 'Update Status', 'current-ltw-projects' ), + 'view_item' => __( 'View Status', 'current-ltw-projects' ), + 'add_new_item' => __( 'Add New Status', 'current-ltw-projects' ), + 'new_item_name' => __( 'New Status', 'current-ltw-projects' ), + 'separate_items_with_commas' => __( 'Separate Statuses with commas', 'current-ltw-projects' ), + 'add_or_remove_items' => __( 'Add or remove Statuses', 'current-ltw-projects' ), + 'choose_from_most_used' => __( 'Choose from the most used Statuses', 'current-ltw-projects' ), + 'not_found' => __( 'No Status found.', 'current-ltw-projects' ), + 'no_terms' => __( 'No Status', 'current-ltw-projects' ), + 'menu_name' => __( 'Statuses', 'current-ltw-projects' ), + 'items_list_navigation' => __( 'Statuses list navigation', 'current-ltw-projects' ), + 'items_list' => __( 'Statuses list', 'current-ltw-projects' ), + 'most_used' => _x( 'Most Used', 'ltw-status', 'current-ltw-projects' ), + 'back_to_items' => __( '← Back to Statuses', 'current-ltw-projects' ), + ), + 'show_in_rest' => true, + 'rest_base' => 'project-status', + 'rest_controller_class' => 'WP_REST_Terms_Controller', + ) ); + +} +add_action( 'init', 'ltw_status_init' ); + +/** + * Sets the post updated messages for the `ltw_status` taxonomy. + * + * @param array $messages Post updated messages. + * @return array Messages for the `ltw_status` taxonomy. + */ +function ltw_status_updated_messages( $messages ) { + + $messages['project-status'] = array( + 0 => '', // Unused. Messages start at index 1. + 1 => __( 'Status added.', 'current-ltw-projects' ), + 2 => __( 'Status deleted.', 'current-ltw-projects' ), + 3 => __( 'Status updated.', 'current-ltw-projects' ), + 4 => __( 'Status not added.', 'current-ltw-projects' ), + 5 => __( 'Status not updated.', 'current-ltw-projects' ), + 6 => __( 'Status deleted.', 'current-ltw-projects' ), + ); + + return $messages; +} +add_filter( 'term_updated_messages', 'ltw_status_updated_messages' ); From 92f570c500b06cea3bdc36d02ad307cccf5a8302 Mon Sep 17 00:00:00 2001 From: Ben Keith Date: Mon, 18 May 2020 18:14:41 -0400 Subject: [PATCH 7/7] Work towards building forms for the custom post type's custom post meta --- .../post-types/projects.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/wp-content/plugins/current-ltw-projects/post-types/projects.php b/wp-content/plugins/current-ltw-projects/post-types/projects.php index bd88d4a..66660c0 100755 --- a/wp-content/plugins/current-ltw-projects/post-types/projects.php +++ b/wp-content/plugins/current-ltw-projects/post-types/projects.php @@ -48,6 +48,18 @@ function projects_init() { 'show_in_rest' => true, 'rest_base' => 'projects', 'rest_controller_class' => 'WP_REST_Posts_Controller', + 'supports' => array( + 'title', + 'editor', + // 'author', + 'thumbnail', + // 'excerpt', + 'custom-fields', + // 'comments', + // 'revisions', + // 'page-attributes', + // 'post-formats', + ), ) ); } @@ -150,3 +162,38 @@ function projects_register_post_meta() { ); } add_action( 'init', 'projects_register_post_meta' ); + +/** + * Add the meta boxes for the projects meta fields + * + */ +function projects_add_meta_box() { + add_meta_box( + 'current-ltw-project', + __( 'Project Metadata', 'current-ltw-projects' ), + 'projects_meta_box', + 'projects', // post type + 'advanced', + 'high', + array( + '__block_editor_compatible_meta_box' => true, + '__back_compat_meta_box' => false, + ) + ); +} +add_action( 'add_meta_boxes', 'projects_add_meta_box' ); + +/* + * Save callback for the project meta fields + */ + + +/** + * The meta box for the project meta fields + */ +function projects_meta_box( $post ) { + // project-contact-name - text + // project-contact-email - email + // project-organization - text + // project-video - url +}