WordPress.org

Ready to get started?Download WordPress

Ideas

QuickPress category, need hooks

  1. Mark / t31os
    Moderator

    12345

    Wanted to follow on from this previous idea regarding adding category selection to QuickPress.

    http://wordpress.org/extend/ideas/topic/quickpress-categories

    Although the callback function for the QuickPress can currently be changed via a dashboard setup filter, it does have one inherent problem, and that's with post.php which deals with saving data submitted via QuickPress.

    Once a post is made, there is a hard-coded call to the original callback function.

    wp_dashboard_quick_press();

    Meaning it's impossible to re-use any new callback function without first reloading the dashboard page. What essentially happens is that the original function is called once a submission has happened (so if like me you write a modified version of the original widget function, it will just look like the category dropdown has disappeared, when in effect it hasn't, it's just called the original function instead).

    No hooks available in post.php to change the hard-coded quickpress call, but you mentioned that changes were likely to be made to accomodate extra functionality. Using 3.0 beta1 and there's been no change to help in this area at all as far i can tell (i wasn't expecting it though, not with custom post types and the MU merge on the horizon).

    Now i guess there may be a few wondering why we can't simply unregister the widget and register a new one, that does the same thing... ahhhh, problem, see post.php , sending the quickpress save action invokes the hard-coded call to the original widget.

    I'm not sure what the solution is, but thought i'd re-air the subject to see how much traction can be gained on moving toward better control of the dashboard widgets, well namingly the quickpress widget, or whether anyone could offer some suggestions on solving this problem(i couldn't find any way to get a reference of the dashboard widgets to know where to start for a patch for this).

    Here's a thread i started that ties in with the above points.
    http://wordpress.org/support/topic/317373?replies=15

    Posted: 4 years ago #
  2. Anointed
    Member

    12345

    a HUGE +1 on this feature addition!

    Posted: 4 years ago #
  3. namnum
    Member

    +1 +1 +1 +1 +1 :)
    Thanks!

    Posted: 3 years ago #
  4. Nom Nom. This feature would be a treat! +1+1+1+1+1

    Posted: 3 years ago #
  5. webgig
    Member

    Actually, I have found a workaround for the category selection being disappeared after post save.It worked for me. Let me know if it works for you guys too.

    function __quickpress_cats() {
    	if(!function_exists('is_admin') || !is_admin()) return;
    	// Parameters for wp_dropdown_categories
    	$args = array(
    		'order' => 'ASC',
    		'hierarchical' => 1,
    		'echo' => 0,
    		'name' => 'post_category[]',
    		'hide_empty' => 0
    	);
    	$select_cats = wp_dropdown_categories( $args );
    	echo '
    	</div>
    	<h4 id="category-label"><label for="post_category">Category</label></h4>
    	<div>
    	'.$select_cats.'
    	</div>
    	<div class="hide-if-no-js" style="margin: 0 0 .5em 5em;padding:8px 10px 5px 5px;">
    	';
    	return;
    }
    if(is_admin() || $query->is_admin) {
    	$here = array( basename($_SERVER['REQUEST_URI']), basename($_SERVER['SCRIPT_FILENAME']) );
    
    	 	if( ( $here[0] == 'index-extra.php?jax=dashboard_quick_press'  || $here[0] ==  'post.php') && ( $here[1] == 'index-extra.php'  || $here[1] == 'post.php') ) {
    		add_action('media_buttons','__quickpress_cats');
    	}
    
    	unset($here);
    }
    Posted: 3 years ago #
  6. Travis Pflanz
    Member

    This code great!

    I'm glad I stumbled upon it.

    Added the code to my functions.php and it worked perfectly.

    I would still like to see it implemented natively into WP, though.

    Posted: 3 years ago #
  7. Great Code and great idea man, i take it :) good idea for the wp_dashboard_quick_press();

    Posted: 2 years ago #
  8. i love this code!!!
    +1 +1 +1 +1 +1 +! :)
    Thanks!

    Posted: 2 years ago #
  9. Ruud Evers
    Member

    12345

    Love this functionality. Doesn't seem to work for 3.3 though. Tried both the version of Mark / t31os and Webgig. Hope this will be implemented soon.

    Posted: 2 years ago #
  10. asdevo
    Member

    12345

    Hey, this would be a really useful option! Why wasn't it implemented until now? The ticket is about two years old. Please consider implementing this feature in the next versions of wordpress.

    Posted: 1 year ago #

RSS feed for this topic

Reply »

You must log in to post.

  • Rating

    12345
    21 Votes
  • Status

    This idea is under consideration