Forums

Ajax toggle button for featured posts? (2 posts)

  1. asimac2001
    Member
    Posted 9 months ago #

    Hi guys!

    I would like to add a toggle button in my edit-posts page which will update custom field 'featured' by simple click while displaying list of my posts.
    The problem is I am not good with ajax...

    So far I have created a custom column for my custom post type by adding this code to functions.php:

    add_filter('manage_edit-nekretnine_columns', 'my_columns');
    function my_columns($columns) {
        $columns['izdvojena'] = 'Izdvojena';
    	unset($columns['custom-fields']);
    	unset($columns['tags']);
        return $columns;
    }
    
    add_action('manage_nekretnine_posts_custom_column',  'my_show_columns');
    function my_show_columns($name) {
        global $post;
    	switch ($name){
    		case 'izdvojena':
    			//HERE I NEED TO DISPAY AN IMAGE OF A STAR, BY CLICKING THAT IMAGE POST IS EITHER FEATURE POST OR IS NOT!
    			break;
    
    	}
    }

    Can anyone help me please? For you ajax gurus out there I am sure this is fairly simple... I have been looking into several plugins that have the similar functionality (admin management xtended toggles post visibility on or off), but haven't been able to do this myself.

    Thanks!

  2. asimac2001
    Member
    Posted 9 months ago #

    Anyone? simple ajax button which updates post meta?

Reply

You must log in to post.

About this Topic