Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the community forum?
All Topics
Marcelo

Filter only displays results after second trigger

Hello , first I would like to congratulate the plugin, it is fantastic.

The plugin I use to create my custom post tyes and my custom fields is tool set types.

Okay . The admin columns works perfectly with respect to display the columns and sort .

My problem is with the filter function.

When I select the field to filter and I trigger the trigger first it displays the result = nothing found , again I trigger the trigger he presents the results correctly.

I’m trying to filter common text fields .

What might be happening?

Thank you for any help.

4 years, 4 months ago
Stefan
Developer

Hi Marcello,

We are very happy to hear that you like our product.
To help you with your problem, I like to know some things.

Is it correct that you’ve tried to add a Custom Field columns to your Custom Post Type overview?
Can you try to disable the other plugin to be sure that no other plugins are altering the query on the overviewpage?

4 years, 4 months ago
Marcelo

Hi Stefan ,
I discovered that the responsible plugin is the WP- Admin Search Post Meta .
I have a large number of custom fields and can not put all of them as a filter in the admin columns , it is important in my case that the pursuit of wordpress can find results related to custom fields.
Do you think there is a way for the two plugins work together ?
Thank you so much.

4 years, 4 months ago
Marcelo

??

4 years, 4 months ago
Stefan
Developer

Hi Marcelo,

Sorry for the late response.
I’m not sure on how to let the two plugin work together.
Both the plugin are changing the WPQuery on the overview, our plugin for both filtering and sorting.
I think this is quite essential for both the plugins.

Our plugin doesn’t have any filters/action (WordPress filter) that possibly can help you, but maybe the WP- Admin Search Post Meta has a filter when you can activate or disable the filter features of that plugin. Then you can check on a admin columns parameter and disable the search by the WPASPM plugin.

4 years, 4 months ago
Marcelo

how can I do it?

4 years, 4 months ago
Stefan
Developer

Hi Marcelo,

We need to know more about this product to help you any further and this is not something I can help you with on short notice.
I will take a look at the plugin and I put this plugin on our list to test with our plugin.
Here’s the ticket: https://github.com/codepress/admin-columns-issues/issues/448

If we found something to solve this issue it will be in a next release but please be aware that this has not our main attention.
Here’s a quick checklist on how you can try to solve it yourself.

1) See where WP- Admin Search Post Meta changes the wpquery
2) See if there is any hook (filter / action) you can use to alter this behavior
3) Use this filter and check on a cpac filter parameters ‘cpac_filter’ to disable the behavior

4 years, 4 months ago
Stefan
Developer

Just a quick update.
If you enable WP_DEBUG
you see that WP- Admin Search Post Meta gives an error when our filter is active and there is a ‘s’ parameter in the URL

In combination with our filter parameter this gives an error but without not.
When you hit the filter again the s paramater is not in the URL, probably because of an php error/notice in the form.
I hope this will help you in the right direction.

4 years, 4 months ago
Marcelo

Ok.

Do you think if I delete the ‘s’ in this line:
$where = preg_replace( “/($wpdb->posts.post_title LIKE ‘%{$wp->query_vars[‘s’]}%’)/i”, “$0 OR $wpdb->postmeta.meta_value LIKE ‘%{$wp->query_vars[‘s’]}%’ “, $where );

I would be ok

4 years, 4 months ago
Stefan
Developer

Sorry I don’t know, you have to test it yourself.
But I think the complete line can be ignored if a filter from Admin Columns is active because that’s the real conflict.

Just a question, are you changing this in the core of the WP- Admin Search Post Meta plugin? Please notice that this is a bad practice as you to have cannot upgrade the plugin without losing these changes. Alway check if there is a filter or action you can use to change to output.

4 years, 4 months ago
Marcelo

$ Where = preg_replace ( “/($wpdb->posts.post_title LIKE ‘% {$ wp-> query_vars [‘ s’]}% ‘) / i”, “$ 0 OR $ wpdb-> postmeta.meta_value LIKE’% {$ wp-> query_vars [ ‘s’]}% “, $ where);

$ Where = “OR ($ wpdb-> postmeta.meta_value LIKE ‘% {$ wp-> query_vars [‘ s ‘]}%’).”

return $ where;

Ok. I tried to ignore the two lines above, but without them the WPAPM plugin stopped working, and the ADMCOLUM filter only works in two steps, select the filter> trigger> nothing found> selects trigger again> results are displayed.

Removing the ‘s’ in the first line, the same result.

Ignoring return $ where; third row, the WPAPM works, however it displays results from all custom post type together and not only in what you are searching. The ADMCOLUM only works in two steps.

Stefan believe this is an issue that I will not be able to solve.

I would like to ask you, I could work with more filters in ADMCOLUM however what I want a few filters is the layout, because when you have multiple columns they will be pressing and is very bad, it can enable a scroll that I can work with a larger number of columns?

Thanks a lot for the help.

4 years, 4 months ago
Stefan
Developer

Hi Marcello,

Sorry, but we can’t help you any further to solve this specific issue.
We cannot create extra filters in our product just to solve this specific conflict with this plugin.
I think it should be possible to create a workaround with the available WordPress filters and/or filters that comes with the WPAPM plugin but you have to figure this out yourself or ask another developer.

4 years, 4 months ago
Marcelo

Stefan believe this is an issue that I will not be able to solve.

I would like to ask you, I could work with more filters in ADMCOLUM however what I want a few filters is the layout, because when you have multiple columns they will be pressing and is very bad, it can enable a scroll that I can work with a larger number of columns?

Thanks a lot for the help.

4 years, 4 months ago
Stefan
Developer

We have a snippet that makes the table scrollable (horizontal) when the table is bigger than 100%.
Then you can set a specific width for your columns and use this snippet:


function cac_table_full_overflow() {
	if ( cpac()->get_current_storage_model() ) : ?>
		<style type="text/css">
			table.fixed {
				display: block;
				overflow-x: auto;
			}
		</style>
		<?php
	endif;
}

add_action( 'cac/admin_head', 'cac_table_full_overflow' );
4 years, 4 months ago
Marcelo

Ok. I put this code in the functions.php of my theme twenty sixteen.
In one of my custom post types I own 17 columns all with width set the total is 121%, yet the scroll did not work.

I leave the auto width?

The snippet is correct?

Thank you.

4 years, 4 months ago
Stefan
Developer

Hi Marcelo,

This snippet does not keep the initial width set in Admin Columns. A table is default max 100%.
When table-cells cannot break the words anymore, this snippet will allow the table to overflow the text and add a scrollbar to horizontal scroll. Please be aware that this is not official support for our plugin but a more common fix/hack to allow table to horizontal scroll.

You can set the initial width of the table to a pixel based value like 200px or even to 200% if you like, but then you table is always 200%. Please try to set a width value for you table until your satisfied.

4 years, 3 months ago
Stefan
Developer

To be more specific. This snippet should work for you 121% table :)

function cac_table_full_overflow() {
	if ( cpac()->get_current_storage_model() ) : ?>
		<style type="text/css">
			table.fixed {
				display: block;
				overflow-x: auto;
				width: 121%;
			}
		</style>
		<?php
	endif;
}

add_action( 'cac/admin_head', 'cac_table_full_overflow' );
4 years, 3 months ago

You must be logged in to reply to this topic.