Hallo zusammen, ich habe gerade versucht den folgenden Code für einen Seitentyp in die function.php einzufügen. Ich bekomme dabei aber immer eine Fehlermeldung (Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\wordpress\wp-content\themes\boldy\functions.php on line 172). Kann mir jemand helfen wo der Fehler im Code ist?
Vielen Dank schon einmal.
<?php
/*********************************************************************************************
Load Translation Text Domain
*********************************************************************************************/
load_theme_textdomain( 'site5framework', get_template_directory() . '/languages' );
$locale = get_locale();
$locale_file = get_template_directory() . "/languages/$locale.php";
if ( is_readable( $locale_file ) )
require_once( $locale_file );
/*********************************************************************************************
Initalize Framework Settings
*********************************************************************************************/
require ('theme-options.php');
/*********************************************************************************************
Content Navigation
*********************************************************************************************/
function site5framework_content_nav() {
global $wp_query;
if ( $wp_query->max_num_pages > 1 ) :
if (function_exists('wp_pagenavi') ) {
wp_pagenavi();
} else { ?>
<nav id="nav-below">
<h1 class="screen-reader-text"><?php _e( 'Post navigation', 'site5framework' ); ?></h1>
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'site5framework' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'site5framework' ) ); ?></div>
</nav><!-- #nav-below -->
<?php }
endif;
/*********************************************************************************************
Seitentyp Produkte
*********************************************************************************************/
add_action( 'init', 'add_cpt_produkte' );
function add_cpt_produkte() {
$labels = array(
'name' => _x('Produkte', 'post type general name'),
'singular_name' => _x('Produkt',
'post type singular name'),
'add_new' => _x('Hinzufügen', 'Produkt'),
'add_new_item' => __('Neues Produkt hinzufügen'),
'edit_item' => __('Produkt bearbeiten'),
'new_item' => __('Neues Produkt'),
'view_item' => __('Produkt ansehen'),
'search_items' => __('Nach Produkten suchen'),
'not_found' => __('Keine Produkte gefunden'),
'not_found_in_trash' =>
__('Keine Produkte im Papierkorb'),
'parent_item_colon' => ''
);
$supports = array( 'title',
'editor',
'thumbnail',
'excerpt');
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'_builtin' => false,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array("slug" => "produkte"),
'capability_type' => 'post',
'hierarchical' => false,
'has_archive' => true,
'hierarchical' => false,
'menu_position' => 20,
'supports' => $supports
);
register_post_type('Produkt',$args);
}
add_action("admin_init", "cpt_produkt_meta_boxen");
add_action('save_post', 'cpt_produkt_daten_speichern');
function cpt_produkt_meta_boxen(){
add_meta_box("preis-meta", "Preis",
"cpt_produkt_feld_preis", "produkt", "side", "high");
add_meta_box("kurzbeschreibung-meta", "Kurzbeschreibung",
"cpt_produkt_feld_kurzbeschreibung", "produkt", "side",
"high");
}
function cpt_produkt_feld_preis(){
global $post;
$custom = get_post_custom($post->ID);
$preis = $custom["preis"][0];
echo '<input name="preis" value="' . $preis . '" />
€';
}
function cpt_produkt_feld_kurzbeschreibung(){
global $post;
$custom = get_post_custom($post->ID);
$kurzbeschreibung = $custom["kurzbeschreibung"][0];
echo '<textarea name="kurzbeschreibung">' . $kurzbeschreibung . '</textarea>';
}
function cpt_produkt_daten_speichern(){
global $post;
update_post_meta($post->ID, "preis", $_POST["preis"]);
update_post_meta($post->ID, "kurzbeschreibung",
$_POST["kurzbeschreibung"]);
}
add_action( 'init', 'cpt_reg_tax' );
function cpt_reg_tax() {
register_taxonomy( "Leistungen",
array( "produkt" ),
array( "hierarchical" => true,
"label" => "Leistungen",
"singular_label" => "Leistung",
"rewrite" => true));
register_taxonomy( "Preisklasse",
array( "produkt" ),
array( "hierarchical" => true,
"label" => "Preisklasse",
"singular_label" => "Preisklasse",
"rewrite" => true));
}
add_filter("manage_edit-produkt_columns",
"cpt_produkt_spalten");
add_action("manage_posts_custom_column",
"cpt_produkt_neue_spalte");
function cpt_produkt_spalten($columns){
$columns = array(
"cb" => "<input type=\"checkbox\" />",
"title" => "Produktname",
"preis" => "Preis",
"kurzbeschreibung" => "Kurzbeschreibung",
"date" => "Hinzugefügt"
);
return $columns;
}
function cpt_produkt_neue_spalte($column){
global $post;
if ("preis" == $column) {
$custom = get_post_custom();
echo $custom["preis"][0];
}
elseif ("kurzbeschreibung" == $column) {
$custom = get_post_custom();
echo $custom["kurzbeschreibung"][0];
}
?>