Articles of filters

Can I change the “Home” text in the menu?

I’m pretty sure this can be done with a filter or some kind of find and replace, but I’m not sure how. I have a page called “Home” like so: When the link is displayed in my template it says “Home”. I’d like it to say “About Us”. I want the user to know which […]

Filter media upload attachment meta

I’m trying to determine a way to access the meta data for an image when it is first uploaded with the media uploader. Looking at the media_handle_upload() function in /wp-admin/includes/media.php I can’t see any filters before the meta data is sent to wp_insert_attachment() wp_update_attachment_metadata(). Sure, I can filter the meta inside using the ‘wp_update_attachment_metadata’ filter. […]

Prepending character(s) to a custom <!–more–> tag title?

I’m hacking around with a blog using Cordobo Green Park and I’ve noticed when I specify a custom title, instead of it beginning with a » symbol (as it does for the standard “» Read more: [POSTTITLE]“) the custom message is simply shown without any prepended character. It’s a shame, because the » character would […]

How to remove the RichText Meta Box

How can I remove the rich text box editor in WordPress? I have used the remove_meta_box function specifying the boxes ID, but it does not work like it does for other core meta boxes: The code I tried: function remove_rich_box() { remove_meta_box(‘postdivrich’, ‘client’, ‘normal’); } add_action( ‘do_meta_boxes’, ‘remove_rich_box’ ); Where the second paratmeter “client” is […]

Is it possible to add an argument to a custom function added to a filter hook?

Example: I’m trying to modify an instantiation of WP_Query by using the posts_orderby filter like so: add_filter(‘posts_orderby’, ‘favorites_orderby’); $new_query = new WP_Query($args); remove_filter(‘posts_orderby’, ‘favorites_orderby’); the favorites_orderby() function is like so: function favorites_orderby($post_in){ if(is_array($post_in)) $post_in_str = implode(‘,’, $post_in); return $post_in_str; } $post_in is an array that changes based on a previous, separate db query, so I […]

Filter have_posts()/ the_post()

What is the best way to filter the posts being displayed? For example in my functions.php file I want to have something like add_filter( $tag, ‘filter_posts’); function filter_posts(){ if(is_home()){ //return custom post query that will be used in loop } }

How can I remove filters from custom post types?

I created a custom post type which I’ll use as landing page for PPC. Now on that custom post type I would like to remove all the filters which are adding the social media buttons for example. I tried already with the following code but that did also remove the shortcode filter which I would […]

Add mime types with plugin

I’ve tried a few plugins to add mime types including the PJW Mime Config plugin. And adding this to a themes functions.php file would work fine, too, for a non-WPMS site. But I need these to be allowable throughout the network. So I’ve written my own plugin to do the trick. After looking at info […]

Custom Queries – Child Categories not showing up

What I’m Doing I have a cities category and normal categories. Right now I have them filtering by category, then when the user clicks a city it will filter by category AND city query_posts(array( ‘category__and’ => array($city, $category)) The Problem That works – no problem. The problem comes when I add sub-categories to my main […]

CSS class on last post in loop ( custom query )

I have been using this question to try to do this but I am having some difficutlty. I have a custom post type, media, and I am working on the archive-media.php template. I have it partially working in that when I delete the if condition out of the code it does add the class, but […]