Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [filters]

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

0
votes
0answers
14 views

How to remove “Taxonomy name:Title” from twentysixteen theme

I am using the Twenty-sixteen theme and have been trying for several days now to remove this part of the theme that displays the taxonomy names at the top. Does anyone know how I can remove this part ...
0
votes
0answers
9 views

How to create multi level post search filter?

I am developing a school website.I want to create a books page in which there should be a filter based on Standard and Subject Like :- Selected Standard > select Subject > Press Filter it will show ...
0
votes
0answers
6 views

Product Tag Cloud filter visible based on category

first time question asker. I am looking to have the "Product Tag Cloud" filter option visible based upon a certain category. I use this widget to help people navigate through a category's shop page ...
1
vote
2answers
61 views

Wrap gutenberg block ‘div’ in other elements/extra HTML

I’m trying to add HTML wrappers around a block to create a clipping effect, something like the below code. It has been suggested this might be possible with the block save or block edit functions? I ...
3
votes
2answers
56 views

Don't replace “|” with Empty String (“”) when generating slugs from title

I work for an architecture company and our project names mostly go like this: house|something, bridge|somewhere, building|whatever. Now, when I want to add a new project named like that, WordPress ...
0
votes
1answer
17 views

Filtering posts by archive showing all years

I have set up a WP_Query within my archive.php page. This is so I can do different things such as pagination etc. I also have two drop down filters categories and archive (yearly). When selecting a ...
0
votes
1answer
39 views

Shortcodes within the sidebar text/html widget: How to preserve the raw HTML output of the shortcode?

WordPress 5.2 destroys structured data by adding rel="noopener noreferrer" to widget output (also to shortcodes): How to display the shortcode output without code change? This feature was added in 5....
3
votes
1answer
80 views

Proper way to use apply_filters() with class functions?

I want to allow my user to override a function. It's a plugin. I believe that apply_filters() can be used for this. this can be overridden by add_filter(). I am confused about how to use it. Say if i ...
0
votes
0answers
10 views

How do I building my own filters for a blog page?

New to wordpress wanted to ask the community if there are any tutorials teaching you how to build filters and getting them to display blog post based on the filters I want to learn so don't want to ...
0
votes
0answers
12 views

ninja forms spam protection input uppercase

I'm using Ninja form spam protection input field, where you choose an answer to your question. Does anybody know how you can force input to be uppercase? I've found a lot of code strings but none of ...
0
votes
0answers
17 views

How to replace old YouTube embed code in Wordpress

I'm moving an old site from ExpressionEngine to Wordpress. The blog has over 3000 posts and some of them have YouTube videos embedded in them using code like this: <object width="425" height="344"&...
2
votes
0answers
62 views

How to use wp.hooks.addAction() in React JS [duplicate]

I am able to successfully use wp.hooks.applyFilters() and wp.hooks.addFilter(), but I'm not able to render a React Component using wp.hooks.addAction(). However, the console.log() runs just fine ...
0
votes
0answers
22 views

Using Filters to modify contect - DB query results alwats appear fist

thanks to help provided by this forum, I have managed to develop a plugin that uses a database of UK towns & postcodes - using the URL parameters to build up a query & display the results. I'm ...
0
votes
0answers
13 views

Gutenberg extend core file block - Add img tag before file name from a hook

There is a hook to extend a core block with filters and add style to a block. function addBackgroundColorStyle( props ) { return lodash.assign( props, { style: { backgroundColor: 'red' } } ); } wp....
0
votes
0answers
15 views

Filter and Display posts by layout

I have structure: navigation: <div class="blog__category" > <ul class=""> <?php $terms = get_terms( 'category', array( '...
0
votes
1answer
28 views

How to change dynamically page title according to variable data?

I created a shortcode for creating dynamic pages with the help of API data. If someone changes the page title I also want changes. Now I have a dynamic page title in a shortcode function, but I need ...
0
votes
1answer
33 views

Widget image reorganize layout

I'm currently using the native widget-image which output content like that: <section class="widget widget_media_image"> <h2 class="widget-title">Some title</h2> <a href="...
0
votes
0answers
23 views

Filter posts instantly based on tags

Being a php newbie I can't figure this one out (should be quite simple, but I still need complete and working examples to work from myself for now). I have a page displaying a list of all posts (> ...
0
votes
0answers
13 views

filter by brand

I have 2 categories of product (shoes and handbag) and some product from these categories have the same brand (Balenciaga handbag and Balenciaga shoes). I want to sort by brand. The problem is that ...
0
votes
0answers
15 views

Override admin selected page layout

I'm using a Genesis child theme and I've set up a filter to force the full width layout when the sidebar is empty. add_filter( 'genesis_pre_get_option_site_layout', 'crc_remove_empty_sidebar' ); ...
0
votes
1answer
29 views

How can I change the button text of a custom widget?

We had a theme developed that has a custom widget class. class ams_button_widget extends WP_Widget { ... public function widget( $args, $instance ) { $btn_text = apply_filters( '...
0
votes
0answers
17 views

oembed_dataparse filter not running at all for standard YouTube embed

I need to wrap a div around all YouTube embeds in posts on our WP site. WordPress version is 4.9.6 The posts in question are WooComerce products Videos are being embedded by simply pasting a YouTube ...
0
votes
1answer
42 views

What Hook/Action is performed when a field in checkout form is changed in WooCommerce

I have added a custom field in WooCommerce checkout like below: function oc_add_checkout_fields( $fields ) { $fields['shipping_sub_area'] = array( 'label' => __( 'Sub Area' ), ...
0
votes
0answers
27 views

How to filter page title for certain page?

I have saved in DB in options an ID of certain page. I wanna use that ID to filter corresponding page title and add a postfix in pages overview as follow. So for example to add postfix "- My Chosen ...
0
votes
0answers
34 views

Restrict retrieved terms by category?

Is there a way to add a layer to the terms to be able to only retrieve the terms based on a category? I have terms attached to multiple different categories, but a lot less in individual categories. ...
0
votes
1answer
33 views

WordPress set featured image to first image of the post

I have tried every solution from similar answers and nothing seems to work on Wordpress 5.0 + When saving a post I want to set its featured image to the first image in the post content. function ...
0
votes
0answers
20 views

How to get all posts together with its category and set each as a class name?

I am trying to retrieve all posts to be displayed on a page. And i plan to use this W3 Resource filter mechanism (javascript in snippet plugin). I already have the category names for each post. For ...
0
votes
1answer
12 views

Add Index to Item in Wordpress Gallery

I'm creating a gallery of images using the [gallery] shortcode and Jetpack's tiled gallery feature. When the user clicks on an image I'm triggering a carousel (Owl Carousel) with carousel.trigger( 'to....
0
votes
0answers
14 views

When searching, dashboard query hangs because of “GROUP BY wp_posts.ID”

The problem is that I have a relatively simple post type with two custom fields that need to sort depending on those fields. I have all of this hooked in to pre_get_posts (along with some other sort ...
0
votes
0answers
11 views

Search by tag inside category page woocommerce

I am working on this site http://peelslapstick.juvoclients.com/ and inside category page there is a filter on the left with the tags (using location names inside tags), this tags were included using ...
0
votes
1answer
24 views

Appending „read more” to the excerpt conditionally

I wonder if anyone knows how to add an if to this function. I need the read more to only be added to the the_excerpt when the category is 429 function mywiki_trim_excerpt($mywiki_text) { $text = ...
0
votes
1answer
26 views

How to display the_archive_title() and the_archive_description() - “weird” interaction

I've got the following code in my "pagetitle" template partial: <?php the_archive_title( '<h1>', '</h1>' ); the_archive_description( '<span class="archive-description">', '</...
1
vote
1answer
30 views

post_type_link filter causes 404 on the CPT page it's used on

When i change the permalink of my CPT using filters it gives a 404. I clicked save in the permalinks settings and switched and saved, but there's still a 404. Is there some kind of hooking up i need ...
0
votes
0answers
27 views

Filter to APPEND nofollow to rel

I am trying append nofollow to add external links. If a link does not have a rel attribute, rel="nofollow" will be added. If a link already has rel="nofollow" nothing will happen, and if a link has ...
0
votes
1answer
25 views

How to add_filter only when content is not empty?

Im trying to add filter but only when the_content is not empty. So I was trying do something like that: <?php $thecontent = get_the_content(); if(!empty($thecontent)) { add_filter('...
0
votes
1answer
16 views

Dropdown Select Post Filter

I would like to display the posts when I click on an item with the dropdown select Currently, my select is OK, all my terms are displayed and all posts too. I just want to know of it's possible to ...
1
vote
2answers
23 views

How to remove filter added by another plugin in a class

Ok I'm struggling here - I feel this should be straightforward but I'm just not able to get it to work. I need to remove a filter added by Woocommerce Subscriptions. The filter is part of the ...
1
vote
0answers
26 views

Admin Backend - Search Pages only by title

I want to modify the pages search in the Admin Backend, so that the search only factor the title of the pages and not the whole text/article. I already found a code for functions.php that works ...
1
vote
1answer
43 views

Get .subsubsub count of post per status queried using pre_get_posts

My following query using pre_get_posts shows the Author only certain posts or pages with certain statuses that s/he should only see and of what belongs to him/her. Is there any way I can get a count ...
0
votes
0answers
34 views

Ajax load more posts with Ajax taxonomy filter

I'm trying to create taxonomy filter with Ajax load more posts, everything is working except the first page on my template! I have a custom template page for taxonomy downloads as below the load ...
2
votes
1answer
25 views

How to re-enable a filter after disabling with __return_false

I can disable a filter as follows: add_filter( 'send_password_change_email', '__return_false' ); This may be a trivial question, but I can't find an answer for it... can I re-enable the filter with ...
0
votes
0answers
8 views

Apply a different filer and parse the entire document instead of just the_content

Good morning, I'm trying to modify a plugin, to lazy load my images (a3 lazy load). The problem is that this plugin is returning only the images in the content, but for some reason when we created ...
0
votes
1answer
50 views

create a shortcode with acf including a filter

I am using advanced custom fields and my problem is: I have several campers for a different number of persons. Now I need a shortcode to display all campers for all certain numbers of persons. The ...
0
votes
0answers
43 views

How to add class dynamically from templates

I would like to add dynamic classes from templates to tags like <main>, <header>, <footer> which are defined in header.php and footer.php. This is something I would like to acheive: ...
0
votes
0answers
32 views

Add select filter based on acf field to custom post type in dashboard

Good morning everyone; I am trying to add a select filter like this: Select filter based on taxonomy To do this, I am getting all field values like: Display all select field values I am able to ...
0
votes
1answer
15 views

How to use filter to disable adding a product to wishlist?

I am using a plugin on my website that made the following filter available: Added filter ‘tinvwl_allow_addtowishlist_single_product’ that helps to show/hide the “Add to Wishlist” button for ...
1
vote
1answer
18 views

Ajax posts filter by date, comments, top views, top likes

I'm trying to create a simple Ajax posts filter, It's working with date and comment but not working with the top views or top likes. So, how can i make the isset( $_POST['top-views'] and isset( $...
1
vote
0answers
21 views

Add filter when image is uploaded?

I'm trying to use this code from another SO resopnse: function ajx_sharpen_resized_files( $resized_file ) { $image = wp_load_image( $resized_file ); if ( !is_resource( $image ) ) ...
1
vote
2answers
114 views

Wordpress Rest filter for custom taxonomy gets applied to the admin area

I have a custom taxonomy called collection, with advanced custom fields in it. I'm using wordpress API, so since I need to filter the API responses by ACF values, I have this filter in my theme ...
0
votes
1answer
67 views

Filter Pages by Custom Field (ACF) in admin area

I'm trying to filter pages in admin area by a custom field created with ACF. I found a function here ( http://www.iamabdus.com/blog/wordpress/filter-custom-posts-by-custom-field/ ) and I adapted that ...