prempwp
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Checkbox issuewell , makes a bit of sense only as of now, but since i am a beginner, can’t expect much from myself… Thanks again.
Forum: Fixing WordPress
In reply to: Checkbox issuekeesiemeijer, You sir, are a legend!!! Thank you so very much, it works like a charm now.
I would like to know what the problem was, theoretically, for example, was there an issue in my save post function??
π
Forum: Fixing WordPress
In reply to: Checkbox issuehttp://pastebin.com/jhwFFCDuHere you go Sir.
Forum: Fixing WordPress
In reply to: Checkbox issueHey keesiemeijer, thanks again.
I tried echoing that, but all it displays is:
pp_is_feat_meta =
Which means, there is nothing in get_option(‘pp_is_feat_meta’); which is why the problem is i suppose.
I also tried manually adding checked=”checked” within the input, like so:
echo "<input type='checkbox' name='pp_is_feat_meta' id='pp_is_feat_meta' value='1' checked='checked' />";And here, the check-box remains checked, which means the only issue is to find out how to get the check-box state (in our case we are using get_option(‘pp_is_feat_meta’);, which doesn’t seem to work)
As for saving the form options:
add_action('save_post',function($post_id){ global $post; if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return; if($_POST && wp_verify_nonce($_POST['pp_nonce'], __FILE__)) { if(isset($_POST['pp_is_feat_meta'])){ update_post_meta($post->ID, 'pp_is_feat_meta', $_POST['pp_is_feat_meta']); } }this one here, saves it on update.
Forum: Fixing WordPress
In reply to: Checkbox issueHey, thanks, and nope, still the same… I guess that false at the end just makes sure that the checked=”checked” does not get displayed in browser.
I am actually concerned if get_option(‘pp_is_feat_meta’) part is correct
Forum: Fixing WordPress
In reply to: Checking if checkbox is checked<input type="checkbox" name="pp_is_feat_meta" id="pp_is_feat_meta" value="1" <?php checked( 'pp_is_feat_meta' , 1 ); ?> />so, is the above statement alright?
Forum: Fixing WordPress
In reply to: Checking if checkbox is checked@frumph: Thanks for your reply, much appreciated.
This is the callback function where i create the check-box:
function pp_is_feat_cb(){ global $post; $meta = get_post_meta($post->ID, 'pp_is_feat_meta', true); wp_nonce_field(__FILE__, 'pp_nonce'); ?> <label for="pp_is_feat_meta"> <input type="checkbox" name="pp_is_feat_meta" id="pp_is_feat_meta" value="" /> Is the post featured?</label> <?php }And heres where i save the meta_boxes:
add_action('save_post',function(){ global $post; if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return; if($_POST && wp_verify_nonce($_POST['pp_nonce'], __FILE__)) { if(isset($_POST['pp_is_feat_meta'])){ update_post_meta($post->ID, 'pp_is_feat_meta', $_POST['pp_is_feat_meta']); } } });Am i wrong somewhere?
Forum: Fixing WordPress
In reply to: Rewriting Custom post typewell, tried reading it, but couldn’t figure out. Please help.
Forum: Fixing WordPress
In reply to: Displaying posts (tricky)OMG this is fantastic: @alchymyth you, sir, freed me from my 3 days struggle. It all works now, it was just a minor CSS problem.
Thank you very much @alchymyth and @esmi as well.
Forum: Fixing WordPress
In reply to: Displaying posts (tricky)@alchymyth, Thanks for your help, i tried that code.
The only thing is, with that code it won’t add the
<li>to the first post, so i modified it to this:<?php $postCount = 1; ?> <?php if(have_posts()) : while(have_posts()) : the_post(); $postCount++; ?> <?php if( $wp_query->current_post%3 == 0 || $postCount == 1) echo "\n".'<li>'; $item_nr = ($wp_query->current_post%3+1); ?> /*all the code here*/ <?php if( $wp_query->current_post%3 == 2 || $wp_query->current_post == $wp_query->post_count-1 ) echo '</li>'; endwhile; endif; ?> </ul>But, now it doesn’t display anything at all. in short, this code doesn’t work.
Forum: Fixing WordPress
In reply to: Slider in wordpressThanks for your reply, but that sorf of slider is not useful to me because i need an image slider. Please try out the demo in this link:
http://css-tricks.com/anythingslider-jquery-plugin/
so you know what i mean.