From 9ba5dad1f1e923c662218df23d4ab477bba50c49 Mon Sep 17 00:00:00 2001 From: Joshua Roy Date: Mon, 8 May 2017 12:07:04 -0400 Subject: [PATCH 1/2] Committing old updates --- template-class.php | 36 ++++++---------------------------- templates/_notes/dwsync.xml | 6 ------ templates/page-purchasing.php | 1 - templates/single.php | 37 +++++++++++++++++++++++++++++++++++ uc-purchasing.php | 26 +++++++++++++++++++++++- 5 files changed, 68 insertions(+), 38 deletions(-) delete mode 100644 templates/_notes/dwsync.xml create mode 100644 templates/single.php diff --git a/template-class.php b/template-class.php index 392f6d7..49c3516 100644 --- a/template-class.php +++ b/template-class.php @@ -77,12 +77,8 @@ class Purchasing_Template_Plugin { // Grab the translations for the plugin add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); - - // Add a filter to the page attributes metabox to inject our template into the page template cache. - add_filter('page_attributes_dropdown_pages_args', array( $this, 'register_project_templates' ) ); - - // Add a filter to the save post in order to inject out template into the page cache - add_filter('wp_insert_post_data', array( $this, 'register_project_templates' ) ); + + add_filter('theme_page_templates', array( $this, 'add_page_templates')); // Add a filter to the template include in order to determine if the page has our template assigned and return it's path add_filter('template_include', array( $this, 'view_project_template') ); @@ -127,31 +123,11 @@ class Purchasing_Template_Plugin { * @verison 1.0.0 * @since 1.0.0 */ - public function register_project_templates( $atts ) { - - // Create the key used for the themes cache - $cache_key = 'page_templates-' . md5( get_theme_root() . '/' . get_stylesheet() ); - - // Retrieve the cache list. If it doesn't exist, or it's empty prepare an array - $templates = wp_cache_get( $cache_key, 'themes' ); - if ( empty( $templates ) ) { - $templates = array(); - } // end if - - // Since we've updated the cache, we need to delete the old cache - wp_cache_delete( $cache_key , 'themes'); - - // Now add our template to the list of templates by merging our templates - // with the existing templates array from the cache. + + public function add_page_templates($templates){ $templates = array_merge( $templates, $this->templates ); - - // Add the modified cache to allow WordPress to pick it up for listing - // available templates - wp_cache_add( $cache_key, $templates, 'themes', 1800 ); - - return $atts; - - } // end register_project_templates + return $templates; + } /** * Checks if the template is assigned to the page diff --git a/templates/_notes/dwsync.xml b/templates/_notes/dwsync.xml deleted file mode 100644 index 52c55e5..0000000 --- a/templates/_notes/dwsync.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/templates/page-purchasing.php b/templates/page-purchasing.php index 31b0980..e32e86c 100644 --- a/templates/page-purchasing.php +++ b/templates/page-purchasing.php @@ -101,7 +101,6 @@ get_header(); ?> +
+
+
+ +
+
+ + + + + + + + + + + +
+
+
+ +
+
+ \ No newline at end of file diff --git a/uc-purchasing.php b/uc-purchasing.php index e95986e..42632f3 100644 --- a/uc-purchasing.php +++ b/uc-purchasing.php @@ -176,7 +176,31 @@ class UC_Purchasing{ // $uc_purchasing = new UC_Purchasing(); - +function add_uc_contract_columns($columns) { + return array( + 'cb' => '', + 'title' => __('Title'), + 'contract_number' => __('Contract Number'), + 'contract_vendor_name' => __('Vendor Name'), + 'author' => __('Author'), + 'date' => __('Date') + ); + //return array_merge($columns, + // array('contract_number' => __('Contract Number'))); +} +add_filter('manage_uc_contract_posts_columns' , 'add_uc_contract_columns'); + +function uc_contract_columns( $column, $post_id ) { + switch ( $column ) { + case 'contract_number': + echo get_field( "contract_number", $post_id ); + break; + case 'contract_vendor_name': + echo get_field( "contract_vendor_name", $post_id ); + break; + } +} +add_action( 'manage_uc_contract_posts_custom_column' , 'uc_contract_columns', 10, 2 ); //=============================================================================== // Contract Archive filter - show a list of contracts on this page //=============================================================================== From c53f8570ae761ad411cfa8def277016cd471dd7d Mon Sep 17 00:00:00 2001 From: Joshua Roy Date: Mon, 8 May 2017 12:09:04 -0400 Subject: [PATCH 2/2] Removing extra file --- templates/single.php | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 templates/single.php diff --git a/templates/single.php b/templates/single.php deleted file mode 100644 index d7572c7..0000000 --- a/templates/single.php +++ /dev/null @@ -1,37 +0,0 @@ - -
-
-
- -
-
- - - - - - - - - - - -
-
-
- -
-
- \ No newline at end of file