WordPress.org

Ready to get started?Download WordPress

Forums

Right Now Reloaded
[resolved] Customize the post types (3 posts)

  1. mamouneyya
    Member
    Posted 2 years ago #

    Hi,

    Working with clients, I sometimes need to hide some post types stats from the widget that I don't want the client to play with or get confused by. Since the plugin doesn't provide a configuration options of any kind, I came to a simple CSS solution using display: none. However, since the< li > tags don't have ids, I had to hide the inside < a > elements directly using their href attributes, something like:

    #md-rnr-content a[href="widgets.php"],
    #md-rnr-content a[href="upload.php"] {
      display: none;
    }

    The problem using this way is that, since we don't hide the < li > elements themselves, they keep shown as an empty space:
    http://grab.by/aJ25

    A simple solution that would help, in case you don't want to go with configuration options complexcity, is to add id attributes to the < li > tags.

    I would appreciate an update for this.
    Thanks.

    http://wordpress.org/extend/plugins/right-now-reloaded/

  2. Michael Dance
    Member
    Plugin Author

    Posted 2 years ago #

    3 options for this:

    Only CSS

    Using the '+' operator to pick adjacent elements would work. For example to erase the third post type listed, you'd add:

    #md-rnr-content tr + tr + tr {
    	display:none;
    }

    This has the side effect of making every post type after the third disappear as well, so you'd have to then add:

    #md-rnr-content tr + tr + tr + tr {
    	display:table-row;
    }

    ...to get them to show up again. And that, it turn, has the side effect of not working in IE7 or less.

    PHP and CSS

    You can add classes to the plugin manually by sifting through right-now-reloaded.php. Here's where:

    Change line 243 to:
    $output[$post_amount] .= '<tr class="rnr-' . $type->name . '-row">';

    Change line 277 to:
    $output[$link_amount] .= '<tr class="rnr-link-row">';

    Change line 303 to:
    $output[$comment_amount] .= '<tr class="rnr-comment-row">';

    Change line 333 to:
    $output[$widget_amount] .= '<tr class="rnr-widget-row">';

    Custom Post Types

    By default only post types with 'public' => true show up in the list. So when registering them you could set them to 'public' => false, though that will have plenty of other ramifications and might not be doable in your case. http://codex.wordpress.org/Function_Reference/register_post_type

    At some point I will probably release a new version to tighten up the code, and when I do I will definitely include classes for rows. Thanks for the heads-up.

  3. mamouneyya
    Member
    Posted 2 years ago #

    Well.

    I don't like the CSS workaround because it is unreliable to depend on the order in my opinion.. something could be changed later. #3 is also out for me because I need to hide some WP default post types which I have no control with.

    About #2, I actually thought of it but I did't like the idea of directly editing the plugin files, since that would make upgrading harder in the future. However, since the new version will come with a solution, it isn't a bad idea..

    I think I will go with #2 for now. Thanks for taking the time, Michael!

    PS That doesn't include the taxonomies, which I also need to hide some of them:
    $output[$taxonomy_amount] .= '<tr class="rnr-' . $taxonomy->label . '-row">';
    Also:

    $output[$link_category_amount] .= '<tr class="rnr-linkcat-row">';
    ...
    $output[$active_menu_count] .= '<tr class="rnr-menu-row">';

    would be nice if you included them also, if you ever update the plugin.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic