Viewing 11 reply threads
  • Author
    Posts
    • #5191
      Anthony
      Member

      I am trying to get a simple checkbox meta attached to a post. I am using this code:

      <?php 
      	
      /*
      Title: Publish (Clearance)
      Post Type: post
      Capability: administrator
      */
      	
      piklist('field', array(
        'type' => 'checkbox'
        ,'scope' => 'taxonomy'
        ,'field' => 'post_clearance'
        ,'label' => 'Cleared'
        ,'description' => 'Administrators & Editors can clear publication for edition.'
        ,'choices' => array(
      	  'cleared' => 'Cleared'
           )
      ));
      	?>

      Two things happen. One is that the meta box does successfully appear, but when I check it and hit update, it doesn’t save it. (Using version 0.9.9.6 beta)

      Essentially using this simple one-option check box to act as a simple boolean function for a pre_get_post call through functions.php. This is what I have, but its not yielding any results of at the moment cause of the issue above.

      function homepage_sticky_date_normalized( $query ) {
      	
           if (is_home() || is_archive() && $query->is_main_query())  
            	$query->set('ignore_sticky_posts', true); // don't stack sticky posts 
              $query->set( 'meta_key', 'clearance' );
              $query->set( 'meta_value', true );
      	 // $query->set('post__not_in', $excludes);
              // $query->set('post__not_in', get_option('sticky_posts')); 
              }
              
      add_action( 'pre_get_posts', 'homepage_sticky_date_normalized' );

      These additional query-sets kill the listing of my posts in the backend.

         $query->set( 'meta_key', 'clearance' );
              $query->set( 'meta_value', true );

      So three problems. :-/

    • #5194
      Steve
      Keymaster

      Is post_clearance a taxonomy?

    • #5198
      Anthony
      Member

      I did set it as a taxonomy to start things off, yeah. Right now I am trying to figure out how to get the setting to stick at this point. Since every time I update the post it doesn’t save it…

      I can see that my query->set to a meta-key was misguided. Any ideas as to why the setting won’t even stick?

    • #5199
      Steve
      Keymaster

      Does it save if you disable this function, homepage_sticky_date_normalized()?

    • #5200
      Anthony
      Member

      no it doesn’t.

    • #5201
      Steve
      Keymaster

      It saves for me. Feel free to zip up your plugin or theme and email to [email protected] Happy to take a look.

    • #5202
      Anthony
      Member
      This reply has been marked as private.
    • #5203
      Anthony
      Member
      This reply has been marked as private.
    • #5204
      Steve
      Keymaster

      Just tested your theme and was able to reproduce. This is a bug that will be fixed in the next version of Piklist. You may want to change this to a select or radio.

    • #5205
      Anthony
      Member

      This might shed a little light … I changed it to ‘radio’ and this is what it did:

      Attachments:
      You must be logged in to view attached files.
    • #5245
      Steve
      Keymaster

      I just tested and was able to reproduce. If I remove the taxonomy scope then it seems to work for me. Can you verify?

    • #5256
      Anthony
      Member

      Verified.

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