A type of hook that provides a way for content to be overridden programatically

learn more… | top users | synonyms (5)

0
votes
1answer
108 views

separate categories with comma and srounded by single quote

hello and sorry for yet another beginner question i am extracting wordpress categories form the array but i want them to be separated by comma my code is <?php $args=array( 'child_of' => 79 ...
1
vote
1answer
874 views

Problem getting single_template filter to work - I want to serve a different single.php file for posts in a certain category

I am trying to customize the behavior of my blog to serve a specific single post template based on the category the post is assigned to. I came across this filter in my parent theme which is what ...
7
votes
2answers
348 views

current_shortcode() - detect currently used shortcode

In a plugin class I want to provide simple fields for public data: email, phone number, Twitter etc. The list can be extended. See the plugin Public Contact Data on GitHub for details. To keep the ...
3
votes
3answers
3k views

How to hook wp_list_pages?

How can I hook the wp_list_pages function so that it reads a value of a custom field and displays it instead of displaying the page title?
2
votes
1answer
282 views

Change WordPress RSS link with filter?

In my theme i use add_theme_support( 'automatic-feed-links' ); to enable the rss links. But i want to create an option to use Feedburner for the main rss feed, my problem is that i don't know how i ...
0
votes
1answer
457 views

Adding tables to dashboard pages programmatically?

I think that is not possible with some actions or filters, I know that I can do it just with html and using right css styles, and of course php to achieve what I need, or to write some minde actions. ...
1
vote
2answers
200 views

What is considered a default query for the request filter?

As stated in one of the answers in this question and in the codex entry for the request filter, said filter gets called only in a default query, such as the main query used for a loop. My question ...
0
votes
3answers
174 views

Order by title without taking into account 'the'

I currently have episodes from a TV Show that feature bands playing, so for example I have: Moby The Dandy Warhols The Kooks My wp_query looks like this: $loop = new WP_Query(array('post_type' ...
3
votes
3answers
191 views

Most efficient way to search for values from CPT in Post content

I have a Glossary CPT. Title, editor, slug and featured image. I would like to add a filter to Post content (and content of my other CPT "species") which looks through all of the content in each post ...
0
votes
3answers
1k views

Can you use add_filter() inside other function?

I'm new to WordPress, and currently developing my first plugin and currently having difficulties. How I can insert the add_filter action inside my submit function? I want the add_filter action to ...
0
votes
2answers
3k views

Post Pagination Showing Same Posts Every Page

So I have this blog that filters by category Then by city. Somewhere while creating the filtration I broke the pagination which seemed to work fine earlier. It doesn't work on my homepage where it ...
-1
votes
1answer
177 views

Applying a filter to multiple loops for days ago

I'm trying to use a filter that limits the days ago loops pull posts from. My problem is that I need different day limits for certain loops on the index page and when I duplicate the filter over a ...
13
votes
5answers
6k 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 ...
1
vote
1answer
3k views

How to filter 'post_gallery' after all other filters/plugins etc

I'm trying to re-format the gallery output a bit, change default columns and link setting, as well as exclude the featured image from the gallery images. I can use *add_filter('post_gallery' ...)* in ...
1
vote
1answer
378 views

How to remove a plugin filter's priority on specific loops (custom queries)?

So I have a review plugin that is automatically sorting all my site based on the score rating. It seems here are the filters the plugin is applying globally: //Post sorting $sort = ...
0
votes
1answer
254 views

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( ...
2
votes
1answer
90 views

How to change domain used when pinging sites

Without boring you with the details of "why" to keep a long story short, I need to change the domain that my site uses when it sends pings. I went and searched the WP source for where this gets set, ...
0
votes
2answers
766 views

Where exactly does the edit_{taxonomy} hook fire?

I'm at my wits end. I'm beginning a project that may involve using an action hook in WP that is not well-documented: edit_{$taxonomy} I'm trying to determine exactly when this hook runs, so I just ...
0
votes
2answers
972 views

wp_list_categories() Exclude All Categories Except One

Is there a way to exclude all categories except one? I want to show a category and it's sub-categories as a dropdown menu, but the admin might add more subcategories to it so I don't want to limit ...
2
votes
2answers
2k views

How can I remove css from a child theme?

I am using the theme twentyten as a parent theme for my child theme. I have other stylesheets I want to use and so I'm trying to figure out how to wp_deregister_style for the style.css sheet that is ...
1
vote
1answer
425 views

How can I make a search form that can search taxonomies and posts?

I have a search bar on the homepage of my theme. I want the user to be able to select from a drop down to search for everything, posts, or taxonomies. I looked at the wp_dropdown function, but its ...
0
votes
1answer
3k views

Filter Posts By Tag

I'm trying to filter my posts by category, then further by city. The only way I can think of filter by city is if the admin adds the city to the listed tags and then filtering from there via switch ...
0
votes
1answer
208 views

Add extra optional text to permalink e.g. “-with-*”

I've been scratching my head about this one for a while. I have tried to add a hook within WP_Rewrite to ensure that we can pick up pages with a similar structure: /products/product1-with-* ...
2
votes
1answer
247 views

Filter Hook Returning Blank When Used Twice

This is a pretty lengthy question, so bare with me. In a plugin I've written that allows users to easily create new meta boxes, I have a function that uses a switch() to return the appropriate HTML ...
8
votes
2answers
13k views

WordPress hooks/filters insert before content or after title

trying to insert content before the post content in my functions.php - I know how to use the regular wp hooks, but unsure how to insert into other areas. Tried this, but it kills content on any other ...
5
votes
4answers
3k views

No filter of code on switch from html to visual editor, how?

Yes, i have found other questions to this topic, but no have the same topic exactly and no solution for my problem. If you include code inside the html-tab and you switch to the visual mode, then ...
0
votes
1answer
948 views

content filter (add_filter) for category description?

I'm running an add_filter function on the_content and I need to run the same function on the category description. Does something like that exist or do I need to create a custom function for it?
2
votes
4answers
2k views

When at / ( or “home”) my menu doesn't get a current-menu-item class

I'm a wordpress noob tweaking a theme, so I'm trying to understand how it works. I've read about 10 related posts in SE but don't get it yet. My problem is as follows: header.php seems to generate ...
3
votes
2answers
2k views

How to add filter with 2 args?

I want to modify $path in the following filter. It has 1 input and 2 args. function documents_template( $template = '' ) { $path = DOCUMENTS_INCLUDES_DIR . '/document/' . $template; ...
0
votes
2answers
287 views

How can I add inline CSS for each image?

Is there a filter or hook that I can use for uploaded media? I need to use it for custom CSS properties based on the media's description. It will be like: <img src="image_url" style="width: ...
0
votes
1answer
170 views

How properly write function to filter content in a template for plugin “multiple content blocks”

In a website I'm building (using my own designed theme, for a business site that doesn't have a blog, IOW, using WP for it's CMS), I have 5 templates: the homepage, the 404 page, the default ...
0
votes
1answer
114 views

Looking for a filter to modify the months

Hi making a simple plugin that replaces the wrong russian month with the right ones. But I can't find any filters that works. I have tried these filters without success: ...
1
vote
1answer
79 views

Publish/Update post is changing image links from file url to post url

I've written a filter to wrap images included in posts with figure tags and their captions with figcaption tags. I turned off the visual editor so that it doesn't strip out all the html from the ...
0
votes
1answer
433 views

Filter dashboard custom post listing by user

Did some research, but I was unable to implement it after all. I have a custom post type accessible only by a new role. I want to filter the post type listing so that each user should see only his ...
0
votes
1answer
670 views

How to prepend text to the_content, but after img/shortcode

I was trying to add some text to the beginning of every post (the text comes from post_meta, but for this example let's assume it's static text). Here's what I tried: add_filter('the_content', ...
1
vote
2answers
157 views

how to determine how many and what kind of arguments are passed to hooks

I am not able to understand a very logic behind add_action / add_filter Consider following example: function SearchFilter($query) { if ($query->is_search) { $query->set('post_type', ...
12
votes
1answer
9k 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. ...
3
votes
1answer
3k views

How does filter the_posts work?

I don't want to display post with empty body / post_content on my home page. So I added below code to my function.php. It detects post with empty body but it still display them. I expected that if I ...
7
votes
3answers
8k views

apply_filters() and the_excerpt are giving unexpected results

I feel like I must be missing something pretty obvious, here, but I can't seem to get WordPress to cooperate. I'm generating Facebook OG tags with a function. Everything works fine, except for the ...
2
votes
2answers
236 views

remove_filter( 'comment_author', 'floated_admin_avatar' ); doesn’t work

In a small plugin I’ve written to add an IP address column to the comments list I want to remove the avatars. In line 156 I tried to use remove_filter: remove_filter( 'comment_author', ...
0
votes
1answer
406 views

category filter doesn't work

I am assuming because I don't have a category template it is defaulting to the archive template, would that affect the outcome. it seems to output all the posts that have categories: ...
0
votes
1answer
152 views

Taxonomy search filters

I have developed an educational courses database of several countries using several taxonomies. Country, institute, study level and some other are taxonomies. If user click on some country, all ...
3
votes
2answers
610 views

How to add filter to __() and _e()?

I would wish to add a filter to _e() and __() functions. The filter is FilterTextOfEmail(). This will basically detect any emails and add anti-spam method to it. I assume, the function for filtering ...
0
votes
1answer
377 views

Modify posts listing at back end

I want to modify posts listing at back end? Say, for a particular user, with role author, O want to list only few posts at posts listing. How can I do this?
-1
votes
1answer
70 views

Removing title from page

Hello attempting to remove the title from static front page using the following code is (not working) in my functions.php function remove_page_title() { if (is_front_page() ) { add_filter( ...
0
votes
2answers
1k views

Removing strip_tags not working on nav_menu_description

So I'm adding descriptions to my site's main menus. Checked the box, added the text. Dropped in a custom walker in functions.php. Dropped in a wp_nav_menu call in header.php to call the custom walker. ...
2
votes
1answer
224 views

Some questions regarding filter

1) Take a look at this example add_filter( "xxx_xxxxx", "blah_blah" ); function blah_blah(){ echo "filter added"; } xxx_xxxxx can be anything like my_filter or it should be one of the ...
0
votes
1answer
296 views

How to add a filter to the get_body_class function?

I see it is possible to use add_filter with the body_class function, but I'm needing to add one to the get_body_class function. How can I add a filter to a function that is not included in the list ...
3
votes
3answers
2k views

How to remove Filters from post admin page?

On a custom post type, I want to remove the filters that show up on /edit.php (where all of the posts are listed out). I have a custom taxonomy that shows up as a filter that I WANT to keep, but I ...
0
votes
1answer
1k 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 ...