Viewing 6 reply threads
  • Author
    Posts
    • #1486

      Ik have just started a piklist tutorial to make a plugin, I added code to make a custom post type. The problem is dat I can’t add an item or edit one as those pages are blank (except for the title). As soon as I activate the twentyfourteen theme all is normal. But with other themes the pages are blank again. The demo piklist is working though. Do I need to activate something in the theme I am using?

    • #1487
      Steve
      Keymaster

      Please make sure you are using the appropriate folder structure for your theme >

      If so, please post some of your code so we can take a look.

    • #1502

      I used it as a plugin and added the same folder structure to the plugin. So not in the theme itself.

      the code that is in the mainfile of the plugin:

      add_filter('piklist_post_types', 'onderwerp_post_type');
      function onderwerp_post_type($post_types)
      {
          $labels = array(
              'singular_name'     => 'onderwerp',
              'search_items'      => __( 'Zoek Onderwerpen' ),
              'all_items'         => __( 'Alle Onderwerpen' ),
              'add_new'           => __('nieuw onderwerp'),
              'add_new_item'      => __('nieuw onderwerp'),
              'new_item'          => __('nieuw onderwerp'),
              'view_item'         => __('Bekijk onderwerp '),
              'edit_item'         => __( 'Wijzig onderwerp' ),
              'menu_name'         => __( 'Onderwerpen' ),
              'not_found'         => __('Niet gevonden'),
              'not_found_in_trash' => __('Niet gevonden in prullenbak'),
              'parent_item_colon' => __('Hoofd onderwerp'),
              'menu_name'         => __('Onderwerpen')
          );
          $post_types['onderwerp'] = array(
              'labels' => $labels //piklist('post_type_labels', 'Onderwerp')
          ,'title' => __('Voeg een titel toe')
          ,'public' => true
          ,'rewrite' => array(
                  'slug' => 'onderwerp'
              )
          ,'supports' => array(
                  'author'
              ,'revisions'
              )
          ,'hide_meta_box' => array(
                  'slug'
              ,'author'
              ,'revisions'
              ,'comments'
              ,'commentstatus'
              )
          );
          return $post_types;
      }
    • #1503

      the folder structure is :

      wp-content
          plugins
              myplugin-piklist
                  parts
                      admin-pages
                      dashboard
                      help
                      media
                      meta-boxes
                      settings
                      terms
                      updates
                      users
                      widgets
                      workflows
                  myplugin-piklist.php
    • #1505
      Jason
      Keymaster

      I don’t know if this is causing the issue, but I’m confused by you’re both adding support for and removing the meta box for author and revisions.

    • #1507
      Steve
      Keymaster

      @bospaddestoel– A few things:

      1) @Jason is correct. You are adding support for “author”, and then using hide_meta_box to remove it.
      2) In the plugin header please include Plugin Type: Piklist, as specified here >
      3) If you want meta boxes and fields to show up, then you need to create them. Use this tutorial to get started.

    • #1528

      ah ok thank you , I will try that, I copied a piece of code without really looking at the meta boxes.

Viewing 6 reply threads
  • You must be logged in to reply to this topic.