Articles of filters

Reposition Woocommerce Message

I’m trying to reposition the messages in my Woocommerce theme. For example the successfully added to cart message. They appear to automatically be placed at the very top of where the woocommerce wrapper start begins. I’ve already found this link which allows me to change the wording of the message but what I need is […]

Conditional add_filter for upload directory?

I have a custom media upload button (in the standard post edit page, alongside the standard media upload button), and need to change the upload directory dynamically if this button is clicked – using add_filter(‘wp_handle_upload_prefilter’, ‘my_function’). This post & answer: Conditional add_filter? seem to give the solution, but for some reason don’t work for me […]

modify a function filter

I am using the latest version of wp-ecommerce (3.89) and a new filter has been introduced to enable role based access to certain dashboard features such as the sales page or upgrade capability. However, the default role in the core file is currently set to “administrator”. What I would like to do is take the […]

check if FILTER(“the_content”) is being executed in `the_post()`

I want to use add_filter(‘the_content’,………..) however, I want that filter only to affect main post’s content. See phseudo-example: <html> ……. <meta decsription>…..the_content…</meta> ……. <left_widget>….the_content…</left_widget> ……. <MAIN_POST>….the_content…</MAIN_POST> <—————– I want only this to be affected …… How to achieve? (of course, out-of-question is the category pages, where post_contents are listed)

Remove function or filter

Im working with a child-theme of WordPress-Bootstrap by I want to get rid of the lead class added to the first paragraph of the content. I looked in WordPress codex in these articles: remove_action remove_filter But im not so experienced in PHP, only HTML – so i cant really tell if its a filter […]

the_posts filter been called multiple time

I have create an endpoint so I can do some checkout processing of my cart. Everything is working fine in sense that every thing is hooked up properly. Though I am having issue that to serve the content of my endpoint, I define the_posts filter, where if my “endpoint” is choosen than I check other […]

WordPress: Apply filter/hook to a particular sidebar widgets?

I’m developing a theme that has more than 5 different sidebars and I want to apply a function to a particular one of them for styling purposes. Basically, the function will modify it’s params using a counter to show random ‘s between each of the widgets. I came up with that: function widget_params( $params ) […]

Where can you find the available filter tags?

In my attempt to alter navigations current-menu-item class, I found a possible solution , add_filter(‘nav_menu_css_class’, ‘my_css_attributes_filter’, 100, 1); He makes use of a filter who is called with a tag ‘nav_menu_css_class’ , But it got me wondering, where can you find information about what filters are available to use? does not mention anything […]

Saving custom profile fields

I’m adding a custom profile field to users of a specific role, like this : function add_custom_profile_fields( $fields ) { // get current user ID $user = new WP_User( $_GET[‘user_id’] ); // get current user role if ( !empty( $user->roles ) && is_array( $user->roles ) ) { foreach ( $user->roles as $role ) { // […]

What's the proper way to use the get_image_tag filter?

I’m attempting to remove the title attribute for post thumbnails (on certain posts), and I assume the get_image_tag filter is the way to do this. However, what I’ve got so far isn’t working. What do I need to change to make this work? My code: add_filter(‘get_image_tag’, ‘image_no_title’); function image_no_title($title) { $title = ”; return $title; […]