Custom Post Type not saving
-
Hi,
I have several meta boxes on different pages. I all call them in 1 plugin called GidsenWG. The meta boxes on the ‘pages’ work fine. But the ones in the Custom Post Types don’t save to the DB. It all worked before the last update.
<?php /* Plugin Name: GidsenWG Description: Make a plug-in that will display gidsItems Version: 1.0 Author: Benjamin lierman Author URI: www.keidigiaal.be */ function gidsenWG() { $labels = array( 'name' => _x( 'Gidsenitems', 'post type general name' ), 'singular_name' => _x( 'Gidsitem', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Gidsitem' ), 'add_new_item' => __( 'Nieuwe gidsitem' ), 'edit_item' => __( 'Edit gidsitem' ), 'new_item' => __( 'Nieuw gidsitem' ), 'all_items' => __( 'Alle gidsitems' ), 'view_item' => __( 'Toon gidsitem' ), 'search_items' => __( 'Zoek gidsitems' ), 'not_found' => __( 'No gidsitem found' ), 'not_found_in_trash' => __( 'No gidsitem found in the Trash' ), 'parent_item_colon' => '', 'menu_name' => 'Gidsitems' ); $args = array( 'labels' => $labels, 'description' => 'Dit zijn alle Gidsitems', 'public' => true, 'menu_position' => 10, 'supports' => array( 'title', 'editor', 'thumbnail'), 'has_archive' => true ); register_post_type( 'gidsenWG', $args ); flush_rewrite_rules( false ); } add_action( 'init', 'gidsenWG', 0 ); add_filter( 'rwmb_meta_boxes', 'westgids_register_meta_boxes' ); function westgids_register_meta_boxes( $meta_boxes ) { $prefix = 'westgids'; // 1st meta box $meta_boxes[] = array( 'id' => 'serie01', 'title' => __( 'De header van de pagina', 'westgids' ), 'post_types' => array( 'page' ), 'context' => 'normal', 'priority' => 'high', 'fields' => array( // TEXTAREA array( 'name' => __( 'Titel', 'westgids' ), 'id' => $prefix . '_titel', 'desc' => __( 'Dit is de titel van de pagina. bv Kijken naar Geschiedenis', 'westgids' ), 'type' => 'text', // CLONES: Add to make the field cloneable (i.e. have multiple value) 'clone' => false ), // TEXTAREA array( 'name' => __( 'Ondertitel', 'westgids' ), 'desc' => __( 'En dit is dan de ondertitel. Hier kun je meer informatie erover geven.', 'westgids' ), 'id' => $prefix . '_ondertitel', 'type' => 'textarea', 'cols' => 20, 'rows' => 10 ) ) ); // 1st meta box $meta_boxes[] = array( 'id' => 'serie02', 'title' => __('De button onder het element', 'westgids'), 'post_types' => array( 'lezingenWG', 'gidsenWG', 'FrontPageWG' ), 'context' => 'normal', 'priority' => 'high', 'fields' => array( array( 'name' => __( 'Knoptekst', 'westgids' ), 'id' => $prefix . '_knoptekst', 'desc' => __( 'Dit is de tekst in de knop van de pagina. bv Reserveer nu', 'westgids' ), 'type' => 'text', // CLONES: Add to make the field cloneable (i.e. have multiple value) 'clone' => false ) ) ); // 1st meta box $meta_boxes[] = array( 'id' => 'serie03', 'title' => __('De 2 elementen op de voorpagina.', 'westgids'), 'post_types' => array( 'FrontPageWG' ), 'context' => 'normal', 'priority' => 'high', 'fields' => array( array( 'name' => __( 'titel01 (boven het lijntje)', 'westgids' ), 'id' => $prefix . '_FP01tekst', 'desc' => __( 'Dit is de tekst die boven het lijntje zal komen.', 'westgids' ), 'type' => 'text', // CLONES: Add to make the field cloneable (i.e. have multiple value) 'clone' => false ), array( 'name' => __( 'titel02', 'westgids' ), 'id' => $prefix . '_FP02tekst', 'desc' => __( 'Dit is gewone titel (zoals je overal anders hebt)', 'westgids' ), 'type' => 'text', // CLONES: Add to make the field cloneable (i.e. have multiple value) 'clone' => false ), // URL array( 'name' => __( 'URL', 'westgids' ), 'id' => $prefix. '_buttonUrl', 'desc' => __( 'URL description idvm http://google.com', 'westgids' ), 'type' => 'url' ) ) ); return $meta_boxes; }In the front:
<?php /* Template Name: Lezingen (Tekst Bovenaan, 3-columns onderaan) */ ?> <?php get_header(); ?> <div id="main-container"> <main id="main" role="main" class="clearfix"> <div id="headerPage"> <h1 class="titel"> <?php echo rwmb_meta('westgids_titel'); ?> </h1> <p> <?php echo rwmb_meta('westgids_ondertitel'); ?> </p> </div> <div id="apartePaginaHomeLinks"> <?php $args = array( 'post_type' => 'LezingenWG', 'order' => 'ASC' ); $loop = new WP_Query( $args ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <article class="small-12 large-4 columns homeLinks left end pageItem clearfix"> <h2><?php the_title(); ?></h2> <div class="itemPhoto" style="<?php $url = wp_get_attachment_url(get_post_thumbnail_id($post->ID)); if(has_post_thumbnail()){ echo 'background: url('.$url.') no-repeat center center; background-size:cover'; } else { echo "display:none"; } ?>"></div> <?php the_content(); ?> <a href="http://westgids.be/contact?onderwerp=<?php the_title(); ?>"><button> <p> <?php echo rwmb_meta('westgids_knoptekst'); ?> </p> </button></a> </article> <?php endwhile; ?> </div> </main> </div> <?php get_footer(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Custom Post Type not saving’ is closed to new replies.