WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] CSS to hide "Quick Edit" link? (11 posts)

  1. sharris203
    Member
    Posted 4 years ago #

    Anyone know any CSS to hide the "Quick Edit" link for pages?

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    I'm pretty sure that any CSS changes to hide this link will hide it for Posts too.

  3. Mark / t31os
    Moderator
    Posted 4 years ago #

    Look back at the example i gave you here..
    http://wordpress.org/support/topic/370002?replies=32#post-1429691

    Then add to it..

    span.inline {display:none!important}

    And the quick edit link will be gone.

  4. sharris203
    Member
    Posted 4 years ago #

    Thanks!

    Complete code for those who come next:

    add_action('admin_init','my_init_method');
    function my_init_method() {
    	// Hook onto print styles action for edit-pages page only
    	add_action('admin_print_styles-edit-pages.php','hide_quick_edit_css');
    }
    function hide_quick_edit_css() {
    	?>
    	<style type="text/css">
    	span.inline {display:none!important}
    	</style>
    	<?php
    }
  5. Mark / t31os
    Moderator
    Posted 4 years ago #

    NOTE: The code will stop working as of WP 3.0 due to changes in how pages are handled in the backend. Pages will be handled by edit.php with a post type of page, instead of the current seperate edit-pages.php

    Just something to remember for the future.

  6. sharris203
    Member
    Posted 4 years ago #

    Good to know! Another CSS question:

    I want to hide various options on the admin General Settings page (specifically only show the Blog Title, Tagline, and Save button). Just hide, not disable. I've tried this code but it doesn't work. Anything more I need to add?

    <div style="display:none;">
    // the code I want to hide from being vivible
    </div>

  7. Mark / t31os
    Moderator
    Posted 4 years ago #

    I can't see any hooks for specifically hiding stuff in the general options page, i can't say i know of any way other then directly modifying the areas you want to hide.

    Next best thing i can suggest is the following plugin, handy for hiding areas of the admin.
    http://wordpress.org/extend/plugins/adminimize/

  8. sharris203
    Member
    Posted 4 years ago #

    I figured it out. I added the style code into the table html, like this: <tr valign="top" style="display:none;">

    I just started using that plugin you mention now for other things and it's great. Thanks for your help!

  9. mariostella
    Member
    Posted 4 years ago #

    I just want to share a little mod on the subject.
    If you are looking to eliminate the quick edit from post edit pages and limit this to all non admins (so admins will still have the function) use the following:

    add_action('admin_init','my_init_method');
    function my_init_method() {
    	// Hook onto print styles action for edit-posts page only
    	add_action('admin_print_styles-edit.php','hide_quick_edit_css');
    }
    function hide_quick_edit_css()
    {
    if (!current_user_can('level_10'))
    {
    	?>
    	<style type="text/css">
    	span.inline {display:none!important}
    	</style>
    	<?php
    }
    }
  10. Mats Mikkel Rummelhoff
    Member
    Posted 4 years ago #

    I needed to add the custom-fields support in order to make use of the Verve Meta Boxes plugin - but didn't want to show the user/admin the actual custom fields box. The aforementioned fixes doesn't seem to work with 3.0, but I found a solution which does:

    http://www.smashingmagazine.com/2009/12/14/advanced-power-tips-for-wordpress-template-developers-reloaded/

    Check out the "Hiding Fields Based on User Role" segment for the solution:

    //hook the admin init
    add_action('admin_init','customize_meta_boxes');
    
    function customize_meta_boxes() {
         remove_meta_box('postcustom','post','normal');
    }

    Sweet! This also works for custom post types.

  11. mariostella
    Member
    Posted 4 years ago #

    mmikkel

    You are right in WP 3.0 the edit urls have changes. So for posts use edit.php for posts and edit.php?post_type=page for pages

    Everything else should stay the same. Not tested though.

Topic Closed

This topic has been closed to new replies.

About this Topic