Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Forum: Plugins
    In reply to: Admin Column Sorting

    @clompers

    To set a custom column to sort by default, try adjusting @tzeldin88’s last code snippet by adding “!isset( $vars[‘orderby’] )” to it, like this:

    /*
     * ADMIN COLUMN - SORTING - ORDERBY
     * https://scribu.net/wordpress/custom-sortable-columns.html#comment-4732
     */
    add_filter( 'request', 'city_column_orderby' );
    function city_column_orderby( $vars ) {
    	if ( !isset( $vars['orderby'] ) || ( isset( $vars['orderby'] ) && 'city' == $vars['orderby'] ) ) {
    		$vars = array_merge( $vars, array(
    			'meta_key' => 'city',
    			//'orderby' => 'meta_value_num', // does not work
    			'orderby' => 'meta_value'
    			//'order' => 'asc' // don't use this; blocks toggle UI
    		) );
    	}
    	return $vars;
    }

    While I certainly think everyone is entitled to his/her opinion, some of the complaints in this thread seem a little harsh and, dare I say, narrow-minded.

    Consider some users NOT in your shoes, who may have looked at toolbar trends (Google+, Twitter, etc.) and said “Gee, I sure wish WordPress provided a persistent toolbar for my users.”

    So WordPress tossed the idea around and ran it through whatever process green-lights new features until it passed muster.

    But like any widely used platform/app, you simply can’t please everyone. Some users won’t like the new features. And they should absolutely feel free to voice their complaints.

    However, I feel that adopting a “how dare they” attitude takes it a little too far and seems naive at best and disrespectful at worst.

    Taking jsalo’s code a little further, you can easily remove any of the nodes in the toolbar:

    function custom_admin_bar() {
    	global $wp_admin_bar;
    	if ( !current_user_can( 'install_themes' ) ) {
    		$wp_admin_bar->remove_node( 'wp-logo' );
    			// or individually remove its children
    			// $wp_admin_bar->remove_node( 'about' );
    			// $wp_admin_bar->remove_node( 'wporg' );
    			// $wp_admin_bar->remove_node( 'documentation' );
    			// $wp_admin_bar->remove_node( 'support-forums' );
    			// $wp_admin_bar->remove_node( 'feedback' );
    		$wp_admin_bar->remove_node( 'site-name' );
    		$wp_admin_bar->remove_node( 'comments' );
    		$wp_admin_bar->remove_node( 'new-content' );
    			// or individually remove its children
    			// $wp_admin_bar->remove_node( 'new-post' );
    			// $wp_admin_bar->remove_node( 'new-media' );
    			// $wp_admin_bar->remove_node( 'new-link' );
    			// $wp_admin_bar->remove_node( 'new-page' );
    	}
    }
    add_action('wp_before_admin_bar_render', 'custom_admin_bar');
    Thread Starter jpmclaughlin

    (@jpmclaughlin)

    Actually, turns out everything was working fine. I had made two simple errors that made me think the whole setup was wrong. I had mistyped the filename for my logo image and I forgot to make changes to the setup page for a plugin. Once I fixed that, everything works great.

    A word to others who may be new to debugging in the WordPress Multisite environment…. When you use WordPress calls such as get_stylesheet_uri(), the paths to theme assets may look wrong, but everything should show up as expected. For instance, in my case, a path to an image would read clients.mysite.com/SITE1/wp-content/themes/site1/images/someimage.png rather than the expected clients.mysite.com/wp-content/themes/site1/someimage.png.

    Thread Starter jpmclaughlin

    (@jpmclaughlin)

    Okay, well the installation worked fine. Some of my plugins don’t seem to work quite right yet, but hopefully that will be easy enough to figure out.

    Thanks for confirming that I wasn’t attempting the impossible (or at least the idiotic).

    That worked. I guess it was corrupt files.

    I’m just use Dreamweaver’s built-in FTP. Doesn’t appear to have a binary setting. I’ll try downloading everything from WordPress again, unzipping, and uploading it again.

    I’ve run across this exact same error. And I also don’t understand what you mean by upload in “Binary mode”. Any other suggestions?

Viewing 8 replies - 1 through 8 (of 8 total)