-
-
Save WinterSoilder/7d3ec8352bf810d4a6670b3bd0f13a92 to your computer and use it in GitHub Desktop.
Wordpress Taxonomy problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: job list | |
Plugin URI: http://example.com/ | |
Description: A complete and practical example of use of the Settings API. This plugin creates a new plugin administration page. | |
Author: WROX | |
Author URI: http://wrox.com | |
*/ | |
function dwwp_register_taxonomy() { | |
$singular = 'Location'; | |
$plural = 'Locations'; | |
$slug = str_replace( ' ', '_', strtolower( $singular ) ); | |
$labels = array( | |
'name' => $plural, | |
'singular_name' => $singular, | |
'search_items' => 'Search ' . $plural, | |
'popular_items' => 'Popular ' . $plural, | |
'all_items' => 'All ' . $plural, | |
'parent_item' => null, | |
'parent_item_colon' => null, | |
'edit_item' => 'Edit ' . $singular, | |
'update_item' => 'Update ' . $singular, | |
'add_new_item' => 'Add New ' . $singular, | |
'new_item_name' => 'New ' . $singular . ' Name', | |
'separate_items_with_commas' => 'Separate ' . $plural . ' with commas', | |
'add_or_remove_items' => 'Add or remove ' . $plural, | |
'choose_from_most_used' => 'Choose from the most used ' . $plural, | |
'not_found' => 'No ' . $plural . ' found.', | |
'menu_name' => $plural, | |
); | |
$args = array( | |
'hierarchical' => true, | |
'labels' => $labels, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => $$slug ), | |
); | |
register_taxonomy( 'location', $args ); | |
} | |
add_action( 'init', 'dwwp_register_taxonomy' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the error message it shows is
Notice: Undefined variable: location in C:\XAMMP2\htdocs\rateIt\wp-content\plugins\job-listing.php on line 37
Notice: Array to string conversion in C:\XAMMP2\htdocs\rateIt\wp-includes\class-wp-taxonomy.php on line 360