2015年10月1日 星期四

Modifying WordPress Publish/Web page Fast Hyperlinks (subsubsub menu)

Screen Shot 2015-10-01 at 9.54.06 AM

In the event you’ve ever accomplished any permission administration that alters what posts, pages or customized submit varieties customers see you then’ve in all probability run into a problem the place the fast hyperlinks on the prime of the admin web page are inaccurate. You might also discover that you simply need to edit, alter or prolong these hyperlinks (which was the case with Project Panorama.) There’s surprisingly little documentation on the way to filter these hyperlinks, so after some head banging towards the wall I found out an answer.

The Filter

You’ll be able to alter the fast hyperlinks by operating a filter on ‘views_edit-submit’. The filter might be custom-made for the publish sort by switching -publish for -web page or -customized-publish-sort.

For instance:

Posts
add_filter('views_edit-publish','your_function_name');

Pages
add_filter('views_edit-web page','your_function_name');

Customized submit sort (films on this case)
add_filter('views_edit-films','your_function_name');

Like several filter, the second argument is your callback perform which has one parameter containing an array with the fast hyperlinks markup. So for those who have been modifying the quicklinks in your “films” customized publish sort you’d have one thing like this:

add_filter('views_edit-films','wp37_update_movies_quicklinks');

perform wp37_update_movies_quicklinks($views) 

     ...

     return $views;



The $views Array

The $views is a 4 merchandise array containing the markup that can be output for the fast hyperlinks. The gadgets are:

$views['publish']

$views['draft']

$views['trash']

$views['pending']

Eradicating Submenu Hyperlinks

Hyperlinks could be eliminated through the use of unset, for instance eradicating the hyperlink to the trash


perform wp37_update_movies_quicklinks($views) 

     unset($views['trash']);

     return $views;



Updating Publish Counts

It’s also possible to alter the views by updating a person merchandise which was needed for Venture Panorama the place some customers might solely see and entry posts assigned to them. For instance, when you have been limiting the customized publish sort of “films” to submit authors you may do one thing like this:


perform wp37_limit_posts_to_author($question)
internationalquestion->is_admin )
return $question;


if( ( !current_user_can( 'edit_others_posts' ) ) && ( $_GET['post_type'] == 'films' ) )


The post Modifying WordPress Publish/Web page Fast Hyperlinks (subsubsub menu) appeared first on DICKLEUNG DESIGN 2014.

沒有留言: