Giving wp_list_categories the class of the category

I would use get_categories() instead, so that you can have better control over the output of your list. And if I recall correctly, wp_list_categories calls get_categories anyway. You can use the same $args array in either function, and you should get the same categories as a result. Then you can simply build your own unordered … Read more

Having a Function Inside of the Loop

Before continuing, please read this: http://www.slideshare.net/andrewnacin/you-dont-know-query-wordcamp-netherlands-2012 It’s by a core WordPress developer and you should consider it required reading. You should never use query_posts, and it’s important to understand how to use loops correctly. That presentation will demonstrate the best practices, how, and why to use them. I can see the approach you’ve taken, what … Read more

How can i change the name order in the admin?

You can’t alter the default Name column, but what you can do is hide it and create your own custom column. First, we add the action and filter on admin_init that will add and manage our new column: function wpa66544_user_custom_column_init(){ add_filter( ‘manage_users_columns’, ‘wpa66544_user_add_column’ ); add_action( ‘manage_users_custom_column’, ‘wpa66544_user_manage_column’, 100, 3 ); } add_action( ‘admin_init’, ‘wpa66544_user_custom_column_init’ ); … Read more

Remove post content from buddypress activity [closed]

You should state which versions of WP and BP you’re using. This should change the content part of what is recorded. You can put it in your theme’s functions.php add_filter( ‘bp_blogs_activity_new_post_content’, ‘record_post_activity_content’, 1, 3 ); function record_post_activity_content($activity_content, $post, $post_permalink ){ if( $post->post_type == ‘post’ ) { $activity_content=”your custom field”; } return $activity_content; }

List all-childpages on parent-page AND list child-pages on childpage itself but not the current one?

function show_subpages() { global $post; $subpages = wp_list_pages( array( ‘echo’ =>0, ‘title_li’ =>”, ‘depth’ =>2, ‘link_before’ => ‘&mdash; ‘, ‘child_of’ => ( $post->post_parent == 0 ? $post->ID : $post->post_parent), ‘exclude’ => ( $post->post_parent == 0 ? ” : $post->ID) )); if ( !empty($subpages) ) { echo ‘<ul id=”subpages” class=”wrapper”>’; echo $subpages; echo ‘</ul>’; } } … Read more

Post processing of uploaded file

You can do this using the wp_handle_upload hook: http://adambrown.info/p/wp_hooks/hook/wp_handle_upload?version=3.4&file=wp-admin/includes/file.php Create a function and add it to this hook so it runs last, it will be passed an array. The array contains the location of the newly uploaded file: add_filter(‘wp_handle_upload’,’wpse_66775_handle_upload’,1000,1); function wpse_66775_handle_upload($args){ $filename = $args[‘file’]; $type = $args[‘type’]; // test if it’s an XML file and … Read more