Code Amp
Forum Replies Created
-
Hey @emgb_520
Essentially we need to create an element that displays the number of results as text / a sentence.
So it’s a feature we need to add (that S&F would hook into).
There might be a way to get this info to display if you’re happy with a bit of PHP coding? I’ll start having a think about this to make sure it is possible… !
Thanks
Forum: Plugins
In reply to: [Custom Layouts - Post + Product grids made easy] Two Layouts on same pageHey @jprichard sorry for the delay, was caught up in a few things last week.
So the outline to get this working would look something like:
1. Assume you are using two different layouts (set to use the same search form)
2. In each layout, make sure to add a custom class in the layout sidebar, we’ll usemy-layout-1andmy-layout-2as an example.
3. Then we need to override theajax containerattribute of the search form (the results area), and tell it to use (first layout).my-layout-1. We can do that using:add_filter( 'search_filter_form_attributes', 'update_ajax_container', 20, 2 ); function update_ajax_container ( $attributes, $sfid ) { // If the search form ID is not 3784, exit if ( $sfid !== 3784 ) { return $attributes; } // The search form id is 3784 so proceed with modification: $attributes['data-ajax-target'] = '.my-layout-1'; return $attributes; }I would go ahead and test this, and make sure that after doing the above, only the first layout is updated when using ajax.
—-
Once that is working, then we can head onto linking the second layout –
my-layout-24. This is the part that’s totally undocumented (it was also only added in a recent release) – we can tell S&F to update any other area of page in the ajax request – so we’re going to set this to to the second layout class with this code:
$attributes['data-ajax-update-sections'] = wp_json_encode( [ '.my-layout-2', ] );Adding this to the previous code, in total, it should look like:
add_filter( 'search_filter_form_attributes', 'update_ajax_container', 20, 2 ); function update_ajax_container ( $attributes, $sfid ) { // If the search form ID is not 3784, exit if ( $sfid !== 3784 ) { return $attributes; } // The search form id is 3784 so proceed with the modifications: // Connect the first layout and set it as the results area $attributes['data-ajax-target'] = '.my-layout-1'; // Add an additional layout to be updated: $attributes['data-ajax-update-sections'] = wp_json_encode( [ '.my-layout-2', ] ); return $attributes; }I *think* that will get you on the right path – let me know if it works out for you? We might need to run the layout javascript again (something I can explain)
And if it does work out, no doubt we’ll need to do a couple of tweaks for pagination too… let me know.
Thanks
Thanks for the kind words @mchelles !
And good to know you’re implementing using the block editor 🙂
~ Ross
Forum: Reviews
In reply to: [Custom Layouts - Post + Product grids made easy] Very simple but flexibleThanks @markoreklaam !
Forum: Plugins
In reply to: [Custom Layouts - Post + Product grids made easy] Two Layouts on same pageHey @jprichard
So this might be a bit tricky to implement but not impossible if you’re happy to get stuck in with a bit of coding…
The issue is that both layouts are assigned to the same search form ID, and S&F only looks for the first instance of
.search-filter-results-2965after an ajax reqeuest, and updates both results layouts to use that.If you’re comfortable implementing some hooks in PHP, I can talk you through a way to achieve what you’re after – but its got a few steps involved and uses an undocumented features in S&F pro (implementation is changing in v3, that’s why its undocumented).
If that sounds like what you’re after (?) then I can start collecting the various hooks we’ll need, and talk you through them.
Thanks
- This reply was modified 4 years, 2 months ago by Code Amp.
As I didn’t hear back from you I’m going to ahead and close this ticket.
Feel free to re-open when you have further information.
Thanks
Forum: Plugins
In reply to: [Custom Layouts - Post + Product grids made easy] CSS style overiddenAs I didn’t hear back from you I’m clsoing this ticket for now.
Feel free to re-open with further information.
Thanks
Forum: Plugins
In reply to: [Custom Layouts - Post + Product grids made easy] Making whole card clickableHey @fariazz
At the moment there is no way to do this – I’ll stick on this on the feature requests and see if it’s something we can add a little further down the road.
Thanks
Hey Polinet,
With the Divi route, did you try adding the S&F Divi extension?
https://searchandfilter.com/documentation/3rd-party/divi/Could you advise if I could use 2 instances of this plugin on the same page with a single search and filter form on the side – with each instance assigned to display its own custom post type but filtered by the same taxonomies from the form? .
So you would have 1 search form, and two results areas, which are both affected by the same search form? And each results area acts on a different CPT?
This might be tricky to setup, but if you can clarify then I’ll be able to advise further.
Thanks
Forum: Plugins
In reply to: [Custom Layouts - Post + Product grids made easy] 2 buttons side by sideHey @herondino apologies for the delay!
I just checked your link and looks like you figured it out with an additional (empty) element, and some clever CSS?
🙂
Hey @nitrospectide
I think the best to way to fix this quickly is if you open a ticket on S&F Pro support “For attention of Ross” and link this ticket –
https://searchandfilter.com/account/support/Then we can better take a look at the errors you’re seeing – it sounds like a javascript issue intially.
Regarding the div, where would you want it? We have hooks for modifying the rendered output of layouts, templates, and template elements – so hopefull you should be able to do this:
https://customlayouts.com/documentation/action-filter-reference/
There are several
render_outputfilters you can use.Thanks
– RossForum: Plugins
In reply to: [Custom Layouts - Post + Product grids made easy] CSS style overiddenHeu @fergumungus – apologies I didn’t see this come through.
There will always be a way to override the CSS if I can see what you’re working with.
Regarding the font, I believe that is now set to
inheritby default so it works better with the fonts loaded in different themes.Do you have a link I could look at?
Thanks
Great news, thanks for letting me know.
Forum: Plugins
In reply to: [Custom Layouts - Post + Product grids made easy] Feature RequestsHey @cbitner – you can achieve this kind of functionality via our pro (paid for) search & filter plugin – setup instructions are here:
https://searchandfilter.com/documentation/search-results/custom-layouts/Hey @sarju747
By default it displays only published posts – you might have something else in your site affecting our queries (so they include drafts)?
Can you try this on a clean / test site and see if you get the same issues?
Thanks