PHP wordpress using checkbox post meta -


This is probably a bit of a basic question, but I'm losing a bit, in fact, I have a custom post type I am trying to create a checkbox meta status.

So what do I have:

My custom-post-class: P>

  function slide_box ( ) {$ Slide_stored_meta = get_post_meta ((int) $ _ request ['post']); ? & Gt; & Lt; Div & gt; & Lt; Label = "slide-checkbox" & gt; & Lt; Input type = "checkbox" name = "slide-checkbox" id = "slide-checkbox" value = "yes" & lt ?? Php if checked (isset ($ slide_stored_meta ['slide-checkbox']) ($ slide_stored_meta ['slide-checkbox'] [0], 'yes');? & Gt; / & gt; & lt ;? php _e ('Display title and quote?', 'Prfx-textdomain')? & Gt; & lt; / labels & gt; & lt; / div & gt; & lt ;? php} add_action ('save_post', 'slide_save_meta ';); Function slide_save_meta ($ postID) {if (is_admin ()) {// checks and saves for input if (isset ($ _POST [' slide-checkbox ']) {update_post_meta ($ postID,' slide-checkbox ',' Yes');} Other {update_post_meta ($ postID, 'slide-checkbox', 'no');}}}?   

It looks like it's okay Saving from, as when I update the post, it is correctly checked on unchecked.

My Theme Template File Next:

   20, 'suppress_filters' => gt; 0));? & Gt; & lt ;? php if ($ slider- & gt; is_pause ()): while ($ slider- & quot; is_post ()): $ slider-> The_post (); ? & Gt; ** & lt ;? Php if (get_post_meta ($ post-> ID), 'slide-checkbox', is true) {? & Gt; **    

Why did you use the zero index? Try Direct Variables:

  Check ($ slide_start_meta ['slide-checkbox'], "yes")    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -