Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Forum: Fixing WordPress
    In reply to: Checkbox issue
    Thread Starter prempwp

    (@prempwp)

    well , 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 issue
    Thread Starter prempwp

    (@prempwp)

    keesiemeijer, 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 issue
    Thread Starter prempwp

    (@prempwp)

    http://pastebin.com/jhwFFCDu

    Here you go Sir.

    Forum: Fixing WordPress
    In reply to: Checkbox issue
    Thread Starter prempwp

    (@prempwp)

    Hey 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 issue
    Thread Starter prempwp

    (@prempwp)

    Hey, 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

    Thread Starter prempwp

    (@prempwp)

    <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?

    Thread Starter prempwp

    (@prempwp)

    @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?

    Thread Starter prempwp

    (@prempwp)

    well, tried reading it, but couldn’t figure out. Please help.

    Thread Starter prempwp

    (@prempwp)

    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.

    Thread Starter prempwp

    (@prempwp)

    @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.

    Thread Starter prempwp

    (@prempwp)

    Thanks 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.

Viewing 11 replies - 1 through 11 (of 11 total)