I am trying to activate a plugin for a Wordpress website I am working on and this is what my error says:
"Parse error: syntax error, unexpected 'global' (T_GLOBAL) in /home/dh_xr8y2y/grindnriseweb.xyz/wp-content/plugins/special-coffee/special-coffee.php on line 104" I have posted the code below and I am not quite sure what I need to fix to activate my code. This is saved under my plugins folder called special-coffee > special-coffee.php. I appreciate your help in advance.
<?php
/*
Plugin Name: Special Coffee CPT
Plugin URI: http://grindnrise.xyz
Description: This plugin creates a custom post type & template page that for special coffees.
Author: Preeti
Version: 1.0
Author URI: https://www.grindnriseweb.xyz/
*/
add_action('init', 'special_coffee_register');
function special_coffee_register() {
$args = array(
'label' => __('Coffee Menu'),
'singular_label' => _('Coffee'),
'public' => true,
'taxonomies' => array('category'),
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => true,
'has_archive' => true,
'supports' => array('title', 'editor', ),
'rewrite' => array('slug' => 'coffees', 'with_front' => false),
);
}
//Register type and custom taxonomy for type.
register_post_type( 'coffees' , $args );
register_taxonomy("coffee-type", array("coffees"), array(
"hierarchical" => true,
"label" => "Coffee Type",
"singular_label" => "Coffee Type",
"rewrite" => true
)
);
add_action("admin_init", "special_coffee_meta");
function special_coffee_meta (){
add_meta_box("coffee-meta", "Coffee Options", "special_coffee_options",
"coffees", "normal", "high");
}
function special_coffee_options(){
global $post;
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id;
$custom = get_post_custom($post->ID);
$name = $custom["name"][0];
$description = $custom["description"][0];
$producer = $custom["producer"][0];
$region = $custom["region"][0];
$varietal = $custom["varietal"][0];
$process = $custom["process"][0];
$elevation = $custom["elevation"][0];
$cupping = $custom["cupping"][0];
?>
<style type="text/css">
<?php include('special-coffee.css'); ?>
</style>
<div class="special_coffee_extras">
<div>
<label>Name:</label>
<input name="name" value="<?php echo $name; ?>" />
</div>
<div>
<label>Description:</label>
<input name="decription" value="<?php echo $description; ?>" />
</div>
<div>
<label>Producer:</label>
<input name="producer" value="<?php echo $producer; ?>" />
</div>
<div>
<label>Region:</label>
<input name="region" value="<?php echo $region; ?>" />
</div>
<div>
<label>Varietal:</label>
<textarea name="varietal"><?php echo $varietal; ?>" /></textarea>
</div>
<div>
<label>Process:</label>
<textarea name="process"><?php echo $process; ?>" /></textarea>
</div>
<div>
<label>Elevation:</label>
<textarea name="elevation"><?php echo $elevation; ?>" /></textarea>
</div>
<div>
<label>Cupping Notes:</label>
<textarea name="cupping"><?php echo $cupping; ?>" /></textarea>
</div>
</div>
<?php
}
add_action('save_post', 'special_coffee_save_extras');
function special_coffee_save_extras(){
global $post;
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ){
return $post_id;
}else{
update_post_meta($post->ID, "name", $_POST["name"]);
update_post_meta($post->ID, "description", $_POST["description"]);
update_post_meta($post->ID, "producer", $_POST["producer"]);
update_post_meta($post->ID, "region", $_POST["region"]);
update_post_meta($post->ID, "varietal", $_POST["varietal"]);
update_post_meta($post->ID, "process", $_POST["process"]);
update_post_meta($post->ID, "elevation", $_POST["elevation"]);
update_post_meta($post->ID, "cupping", $_POST["cupping"]);
}
}
?>