Skip Navigation

[Resolved] Custom filter drop down and ajax refresh doesnt work

This support ticket is created 6 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 1.24 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Noman 6 years, 8 months ago.

Assisted by: Noman.

Author
Posts
#561833

Hi, im trying to create a filter function with 2 drop down select boxes (for post type and category). But when i select or change options from the select boxes, no results are shown, only the default list of posts.

Can you look at my view and see if im doing anything wrong. I can provide access. Please enable private message so that i can provide details to the page/edit page/view URL

#561848

Some code in case it could be useful to someone.

Filter Editor:

[wpv-filter-start hide="false"]
			<div class="filter-top">
				<h2>Filter</h2>
              	[wpv-filter-controls]
				<div class="filter-form">
					<div class="select">
                      	[wpv-control url_param="select_type" type="select" default_label="Type" values="all,blog,whitepaper" display_values="Type,Blogs,Whitpapers" output="legacy"]
					 </div>
					 <div class="select">
                      	[wpv-control-post-taxonomy taxonomy="category" type="select" default_label="Topic" url_param="select_category" output="legacy"]
					 </div>
				</div>
                [/wpv-filter-controls]
			</div>
[wpv-filter-end]

Loop Editor (modified):

[wpv-layout-start]
	[wpv-items-found] 
	<!-- wpv-loop-start -->
	<ul>
		<wpv-loop>
			<li class="one_fourth">
				[wpv-conditional if="( NOT(empty($(whitepaper-tile-image))))"]
				<div class="whitepaper-box">
					<img class="b-lazy" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="[types field='whitepaper-tile-image' size='medium' output='raw'][/types]" alt="[wpv-post-title]" title="[wpv-post-title]" />
					<div class="content-overlay"> <span>whitepaper</span> [wpv-post-link] </div>
				</div>
				[/wpv-conditional]
				[wpv-conditional if="( empty($(whitepaper-tile-image)))"]
				<div class="blog-box">
					<div class="content"> <span>Blog</span> [wpv-post-link] </div>
				</div>
				[/wpv-conditional]
			</li>
		</wpv-loop>
	</ul>
	<div class="clear"></div>
	<!-- wpv-loop-end --> 
	[/wpv-items-found]
	[wpv-no-items-found] <strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong> [/wpv-no-items-found]
[wpv-layout-end] 

Filter and Loop Output Integration Editor:

<div class="section insight-filter med-gray">
	<div class="container">
		<div class="columns six color-dark">
          [wpv-filter-meta-html]
          [wpv-layout-meta-html]
            <a class="button-cta button-large" href="#">load more (this doesnt work)</a>
		</div>
	</div>
</div>
#561920

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting Toolset Support. I have created a new “Test view 2” and added the post type filter and it is working but does not give the correct results after first filtration, taxonomy filter is working fine, please check here: hidden link
The same Post Type filter or code works fine in my test site though.

1. There is some cache issue, please delete all sort of caches in your site plugin cache (W3 Total Cache), CDN / server cache (if any), browser cache too. Deactivate W3 Total Cache plugin for testing too.

2. Could you please also try to check it by deactivating all third-party plugins (except Toolset) and switching back to the Default Theme (e.g. Twenty Sixteen theme) to see for any possible conflicts with any of the plugins or themes?

Toolset does not have any builtin post type filter yet. If you would like to do Filter by Post Type you would need to use this code snippet which you are already using:
https://toolset.com/forums/topic/post-type-filter/#post-486216

Usually Post Type filter works if we don’t have any other filters in the View - Settings here: https://toolset.com/forums/topic/filter-by-post-type/#post-537811

Thank you

#562072

Hi there,
Unfortunately, im trying to do an ajax query, not a click submit type query. The ajax is what doesnt work/get triggered.

But based on your comment, it does sound like there is no support for both a Custom Post type filter along with a taxonomy filter. I will need to find a new solution not using wp-types then

#562101

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Okay thank you for understanding. This plugin might also be useful for you:
https://wordpress.org/plugins/search-filter/

Have a great day, thank you

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.