Changeset 2174100
- Timestamp:
- 10/16/2019 08:17:09 AM (6 years ago)
- Location:
- wpjm-company-profile-page/trunk
- Files:
-
- 3 edited
-
readme.md (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
wpjm-company-profile-page.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpjm-company-profile-page/trunk/readme.md
r2173686 r2174100 26 26 = 1.2 = 27 27 - Tested up to WordPress 5.2.4 28 29 = 1.2.1 = 30 - Enabled metabox for the new Editor since WP5.0+ -
wpjm-company-profile-page/trunk/readme.txt
r2173686 r2174100 31 31 = 1.2 = 32 32 * Tested up to WordPress 5.2.4 33 34 = 1.2.1 = 35 * Enabled metabox for the new Editor since WP5.0+ -
wpjm-company-profile-page/trunk/wpjm-company-profile-page.php
r2173686 r2174100 6 6 * Author: Gabriel Maldonado 7 7 * Author URI: https://tilcode.blog/ 8 * Version: 1.2 8 * Version: 1.2.1 9 9 * Text Domain: wpjm-company-profile-page 10 10 * Domain Path: /languages … … 76 76 $plugin_dir_path = plugin_dir_path( __FILE__ ); 77 77 $company_template_url = $plugin_dir_path . 'company-archive-page-template.php'; 78 79 if ( is_tax('companies') ) { 80 78 79 if ( is_tax($taxonomy="companies") ) { 80 81 // TODO: Sometimes this fails as is_tax() returns NULL. This can be fixed flushing the cache via $wp_rewrite->flush_rules( true ); but is an expensive operation. Would be a good idea to integrate this somehow if the page returns a 404 for example. 81 82 $template = $company_template_url; 82 83 return $template; … … 89 90 90 91 /* 91 * Creates custom companies/company taxonomy 92 * Creates custom companies/company taxonomy. This will show under Job Listings > Companies as well as within the Editor metabox 92 93 */ 93 94 function gma_wpjmcpp_job_taxonomy_init(){ … … 99 100 'label' => __( 'Companies', 'wpjm-company-profile-page' ), 100 101 'rewrite' => array( 'slug' => 'company'), 101 'public' => true 102 'public' => true, 103 /* 104 Necessary after WP 5.0+ in order to show the metabox within the editor. Since the editor operates using the REST API, taxonomies and post types must be whitelisted to be accessible within the editor. 105 https://developer.wordpress.org/reference/functions/register_taxonomy/ 106 */ 107 'show_in_rest' => true, 102 108 ) 103 109 ); … … 206 212 207 213 $data = get_post_meta( $post->ID, "_company_name", true); 214 // ## 215 //var_dump($data); // string(0) in http://localhost:8888/local/job/new-job-2/ 216 //wp_die(); 217 // ## 208 218 $the_new_company_taxonomy = wp_get_post_terms($post->ID, 'companies'); 209 $single_company_slug = $the_new_company_taxonomy[0]->slug; 210 $url = home_url() . '/company/' . $single_company_slug; 219 // ## 220 //var_dump($the_new_company_taxonomy); // OK, data added in wp-admin is here. 221 //wp_die(); 222 // ## 223 224 225 $single_company_slug = $the_new_company_taxonomy[0]->slug; 226 $url = home_url() . '/company/' . $single_company_slug; // OK, page is created. 227 228 211 229 212 230 // Checks if the company name has been added as a tag to the individual job listing
Note: See TracChangeset
for help on using the changeset viewer.