A type of hook that provides a way for content to be overridden programatically
12
votes
2answers
450 views
How to remove a filter that is an anonymous object?
In my functions.php file I would like to remove the below filter, but I'm not sure how to do it since it's in a class. What should remove_filter() look like?
add_filter('comments_array',array( ...
9
votes
3answers
4k views
Saving Taxonomy Terms
I have an interesting problem which I hope someone can quickly answer.
I have created my own metabox which, based on "MY METABOX CODE" (list below) is correctly displaying a dropdown list of all my ...
11
votes
4answers
3k views
single-{$post_type}-{slug}.php for custom post types
My favorite part of the Wordpress template hierarchy is the ability to quickly create template files for pages by slug, without having to edit the page in Wordpress to select a template.
We can ...
7
votes
1answer
1k views
Passing a parameter to filter and action functions
Is a way to pass my own parameters to the function in add_filter or add_action.
For example take a look in the following code:
function my_content($content, $my_param)
{
do something...
using ...
5
votes
1answer
2k views
How to add defer=“defer” tag in plugin javascripts?
I couldn't add defer tag in plugin javascripts. Google developer pagespeed test suggests me to add defer tag in contact form 7 javascripts.
This is how contact form 7 includes javascript in header.
...
2
votes
1answer
537 views
How can I display parent and child taxonomies in separate drop downs?
The requirement is where i have a taxonomy State which is the parent and it has a child sub-taxonomies they are the Cities, Need to display the state as a drop down, when i select the particular state ...
19
votes
4answers
10k views
Filter to remove image dimension attributes?
I'm working on a site based on a fluid width css template which sets a max-width on images to the width of the column containing them, and I need to remove the inline width and height dimension ...
0
votes
1answer
97 views
Exclude custom function content from certain pages
I have added a small custom function to display a little author bio blurb at the bottom of each blog entry in my functions.php file inside the current theme that I am using. So far so good, it is ...
9
votes
2answers
4k views
Explanation for apply_filters function and its variables
I'm learning how to build html forms using PHP by taking an example from "simplr form registration" plugin.
I'm looking at this code:
$form .= apply_filters('simplr-reg-instructions', __('Please ...
5
votes
3answers
450 views
Filter any HTTP request URI?
I want to filter any HTTP request URI done through the HTTP API.
Use cases:
The WordPress update check goes to http://api.wordpress.org/core/version-check/1.6/, but ...
3
votes
5answers
2k views
Remove classes from body_class
I don't need this whole mess of classes like this...
<body class="page page-id-829 page-template page-template-page-template-portfolio-php portfolio">
I'd like something like this...
<body ...
3
votes
1answer
2k views
Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
This answer is very close to what I am looking to do, but instead I would like to specify a specific custom field and display a select menu of its available values. Thanks!
1
vote
1answer
172 views
What hooks/filters are there to alter selected terms on post save?
Very simple, where would I hook/filter to alter the users selection of terms when they save a post (Update or Add)?
I need to hook in all instances; such as when saving a post via AJAX, saving when ...
3
votes
2answers
576 views
add_filter and changing output captions of image gallery
I'd like to change only one output of native WP Gallery (in media.php)
On Smashing Magazine (link) author advises to change whole gallery_shortcode function.
But I wondered if is possible to change ...
3
votes
1answer
326 views
Update post counts (published, draft, unattached) in admin interface
I am working on a multi-user WordPress setup and have made it so a particular type of user can only see and interact with posts, images, pages etc that they have authored. The code to make this happen ...
0
votes
2answers
126 views
How can I find out what an `apply_filter` call is actually doing?
As an example, I'm looking at class-wp-xmlrpc-server.php and there's a line (~115) that says:
$this->methods = apply_filters('xmlrpc_methods', $this->methods);
How can I actually find out ...
0
votes
2answers
444 views
Make parent categories not selectable
I'd like that my categories having child-categories don't be selectable on the post article page.
What I want to do is to remove the checkbox before their label.
I've looked the filter documentation ...
4
votes
5answers
485 views
Implementing advanced add_* function wrappers
add_action() and add_filter() are major functions. However in some scenarios add one more function and hook it somewhere approach gets bulky and inconvenient.
I had determined for myself several use ...
6
votes
1answer
339 views
Changing JPEG compression depending on image size
Short. I want ''large' images compressed by 90%, and 'medium' to be by 60%. Has many af you know, sometimes larger images suffer from high compression, but other small images don't.
This function ...
2
votes
1answer
647 views
Is it possible to use a forgot password url filter?
i recently found that a login url filter is available but i can't find a solution for the forgot password as well,
for the login url i use this:
function custom_login_url($login_url) {
return ...
0
votes
1answer
696 views
How to display a shortcode caption somewhere other than the_content
I want to disable shortcode captions for posts in one of my themes, and display the content elsewhere, such as in a sidebar.
The images aren't uploaded to wordpress, but they're linked-to using the ...
2
votes
2answers
2k views
Add_Filter example for wp_get_attachment_link
Let me preface by saying I don't really understand Add_Filter, but I think that I want to be using it here. If not please let me know.
I want to modify wp_get_attachment_link so that the link url ...
2
votes
3answers
1k views
Loading template files from a subfolder in my theme?
I am working on a site that will have up to 30 templates in it.
I don't want to have all those templates at the root of my theme folder cluttering up everything.
I know how I can modify the ...
2
votes
8answers
7k views
Filter get_categories() for taxonomy term in WordPress
I want to show a category only if a (custom) post is in that category AND region = $name for that post.
So, e.g. I have a custom post (type "business") named "Mamma Mia" in child-category: ...
1
vote
2answers
882 views
Conditional add_filter?
I need to apply an add_filter from my functions.php but only if the user has opened media-upload.php from my custom function. Is it possible to send a variable when opening media-upload.php that I ...
0
votes
1answer
117 views
How-to inspect filter-able $vars?
Note: This is more of a tutorial/wiki than a real question and should be a reference for later Questions. If you got something to add, please feel free to add an answer. Working answers get upvoted. ...
3
votes
1answer
191 views
How to add filter in “Comments” at the admin panel?
I found so many information and most of the tutorials only talk about adding filter in post/custom post only.
I want to do something similar to this tutorial in 'Comments' area in admin panel.
Add ...
3
votes
1answer
305 views
How to apply a class to the second word in menu list item?
I want to apply a class to a word in my menu. For example, say I have a list item in my menu called "My Item". I would like to apply a class to the word "Item" so that I can style it anyway I want.
...
2
votes
1answer
240 views
How to remove or replace the log-in link for comment replies?
I need to edit the function get_comment_reply_link() in wp-includes/comments-template.php. All I really wanna do is take out the "log in to reply" text is puts in every comment for logged out users ...
2
votes
2answers
735 views
Get password when user registers and save it sha1 into database
im working on a website where the users can connect with iphone to some functions of it by using a sha1 encrypted password. In other words the plain password of wordpress encrypted in sha1.
In the ...
1
vote
2answers
1k views
What is the filter hook for custom fields content?
The following code hides "the_content" output
add_filter( "the_content", "cp_module_pcontent_post_content" );
function cp_module_pcontent_post_content($content){
global $post;
...
1
vote
1answer
152 views
Change comments form title on a page by page basis
I'm looking to change the comments form title (my theme defaults this to "Leave a Comment" or "Leave a reply to").
I thought perhaps I could add a hook to comment_form_defaults but my snippet below ...
1
vote
2answers
3k views
How do I filter title and alt attributes in the gallery shortcode?
I am displaying a post gallery inside a custom post type, using the following in my single-custom.php template:
<?php echo do_shortcode('[gallery id="'.$post->ID.'" link="file" columns="5" ...
1
vote
3answers
856 views
How do I filter the excerpt metabox description in admin?
I want to change the default "Excerpts are optional hand-crafted summaries of your content that can be used in your theme. Learn more about manual excerpts." help text below the Excerpt input area to ...
1
vote
1answer
781 views
Title_save_pre - Simple problem that u know for sure
I have two custom post type. Then I need to use title_save_pre to post title prior to saving it in the database. I need to use this filter just for one custom post type.
This is my function:
...
0
votes
0answers
67 views
How to build a search filter?
Can annybody tell me how can i build a search filter.. were do i start.
I want to filter the categories for 3 post type's
Ex:
I have Movies(posts) with categories
Year: 2011,2012,2013
Gene: ...
8
votes
4answers
1k views
remove_action or remove_filter with external classes?
In a situation where a plugin has encapsulated its methods within a class and then registered a filter or action against one of those methods, how do you remove the action or the filter if you no ...
3
votes
1answer
302 views
Set JPEG compression for specific custom image sizes
I use various custom image sizes (by add_image_size) and I have set my JPEG compression to 30% with this filter:
function jpeg_quality_callback($arg) {
return (int)30;
}
add_filter('jpeg_quality', ...
4
votes
1answer
2k views
Removing Image and Caption Dimension Attributes
This question is an offshoot from the this discussion on removing dimension attributes from images. The solution code provided on that thread works very well except that it has the unfortunate side ...
2
votes
3answers
3k views
Moving sharedaddy buttons (in Jetpack) to the top of a post?
How would one move the sharedaddy buttons included in Jetpack to be placed before a post's or page's content, rather than after it? I see that in sharing-service.php the function that prints the ...
2
votes
2answers
92 views
Filtering 'the_title' with option to return subhead?
Problem:
The WordPress iPhone app (and other WordPress-related smartphone apps) do not allow for much other than the Title and Body fields (i.e. no access to custom fields).
Goal:
My current ...
2
votes
1answer
335 views
Rename image uploads with width in filename
I am attempting to change the name format that Wordpress uses to rename uploaded files. For example, when I upload an image with filename "cat-picture.jpg" Wordpress will create scaled versions and ...
0
votes
1answer
702 views
Help With issue on pre_get_posts filter in taxonomy
I create a function to filter the taxonomy query with this code
add_action('pre_get_posts', 'custom_taxonomy_query');
$option_taxposts_per_page = get_option('tax_posts_per_page');
function ...
0
votes
3answers
9k views
Is there any multiple filter/criteria plugin for wordpress?
I'm interested in a wordpress plug-in that is able to make from tags or categories multiple search criteria like left hand side of the following site system http://www.olx.com/dvd-cat-238
When one of ...
3
votes
1answer
301 views
Custom filter for the_content doesn't work correctly
=====THIS POST HAS BEEN UPDATED===== SCROLL TO THE BOTTOM TO READ THE UPDATE!
I asked a question yesterday that a gentleman named Tim was nice enough to take a stab at. He helped me through writing a ...
3
votes
3answers
1k views
How to correctly get post type in a the_title filter
I want to prepend text to the post titles of a specific custom post type, but the filter below didn't work. Instead of changing only that CPT's post titles, it changed all titles on the given CPT's ...
2
votes
3answers
247 views
Filter to modify post_title after image upload?
When I upload images, Wordpress 3.4.2 sets the Title to the base of the filename, such as "DSCN1234" or "IMG_1234". I'd like the Title to be left blank.
The code that sets the Title during the upload ...
2
votes
2answers
201 views
Removing default image size list in Media Box
I trying to remove unused image size (Thumbnail, Medium, Large) in MediaBox
Any function can i use in functions.php ? or some trick ?
PS : I know i can use jQuery trick but any better function to ...
2
votes
1answer
220 views
Adding posts of custom type into the main feed
I'm having some trouble with a subject that seems to be pretty basic, so I'm starting to feel (a little, only a little) dumb :-)
Here's the thing: I want my main feed to include the posts and other ...
2
votes
2answers
188 views
Load different template file when condition met?
If I visit a page on my WordPress site, WP goes and determines what template file it should use based on the template hierarchy.
If I'm doing some logic checking in the hook init and say my ...