Forums › Forums › Search & Filter Pro › Add existing parameters of query to shortcode
Tagged: feature request
- This topic has 16 replies, 2 voices, and was last updated 9 years, 1 month ago by Ross.
-
Anonymous(Private) October 4, 2015 at 6:43 pm #26464
For sample, I need to integrate this plugin (Search & Filter Pro) with WP-SHOP plugin: site of plugin.
Work logic of this plugin in my site:
Posts-“categories” have shortcodes of shop.Handler of this shop shortcode do:
Show data of some posts in same category (or same tag): pictures, some additional fields (same as price).Part of handler’s code (can be overwritten in theme)
$posts_per_page = $this->rowCount * $this->colCount; if (isset($this->category)) { $selection = "cat={$this->category}"; } else { $selection = "tag={$this->tag}"; } global $post; $page_id = $post->ID; $if_child = get_post_meta($page_id, 'collections_view', true); if ($if_child == 'on') { $orderby = "meta_key=orderbymeta&orderby=meta_value_num"; } else { $orderby = "orderby=post_title"; } ?> ... <?php if (function_exists('wpfp_link')) { wpfp_link(); } $query = new WP_Query("{$selection}&showposts={$posts_per_page}&post_type=any&{$orderby}&order=ASC&nopaging=true");
So I need to pass
$selection
“as is” (maybe filtered to avoid hijacking) in Search & Filter Pro shortcode.Or, another way:
Provide API to change Search & Filter Pro queries “on the fly”.Ross Moderator(Private) October 5, 2015 at 9:23 am #26490Hey Sergey
You can modify the query on the fly by modifying the parameters that are passed to Search & Filter queries – its not so well documented but mentioned here with example in the upgrade notes:
I’m hoping this will do what you need ๐
Thanks
Anonymous(Private) October 5, 2015 at 1:25 pm #26518But I want to use one Search & Filter form for different collections ๐
Collection = all posts with same category or same tag.
Algorythm of WP-Shop.
In post-category I put shortcode of “vitrine”. This shortcode puts all posts with price and same category (or tag).
I can modify template of “vitrine” and put shortcode of Search & Filter there.
But same template of “vitrine” works on different collections ๐ So I need to attach
cat={$this->category}
ortag={$this->tag}
from template, not statically predefined filter.Ross Moderator(Private) October 6, 2015 at 6:47 pm #26651Hey Sergey
I think we’re getting confused.
So, what you would like to do (as an example) is pass the category through to S&F, in the shortcode or something similar.
Well, this is not yet possible, but you can use the shortcode like you mention above, and then use the filter
sf_edit_query_args
in the link above to limit the tag/category to whatever you like.So in this way it is dynamic and according the cat/tag you supply via some custom php code.
Does that make sense?
Thanks
Anonymous(Private) October 7, 2015 at 8:57 am #26679Sorry, I can’t go by this way, because I can’t pass category or tag into
sf_edit_query_args
๐Category isn’t fixed, it get from post with vitrine shortcode. So different vitrines have different categories, but shortcodes in the posts can be same!
Ross Moderator(Private) October 8, 2015 at 4:06 pm #26865I’m not sure I follow what you are trying to do then.
Are you trying to use the vitrine shortcode to display your results?
I’m not familiar with WP Shop.
Thanks
Ross Moderator(Private) October 13, 2015 at 12:17 pm #27194Hey Sergey
As I’m not familiar with that plugin, it makes understanding what you are trying to achieve very confusing – I have no idea what the vitrine shortcode is or truly how it works.
If I find some time I’ll take a look to get a better understanding but for now I would say it sounds like the two plugins can not be used in that way together.
Thanks
Anonymous(Private) October 17, 2015 at 7:32 am #27573Let’s try one time more to explain you the problem.
Vitrine shortcode is:
For sample, I have page http://vkplitka.ru/zerkalnaya-plitka/
Vitrine shortcode is
[vitrina zerk-plitka 3 420 99 99]
where
zerk-plitka
is category or tag of goods.Plugin checking, is it category, or tag, then render “vitrina” template. Plugin already have interface for intercepting this call and render file “vitrina.php” from theme folder instead of plugin folder.
So I trying to implement in template “vitrina.php” in theme instead of vitrine “by default” search form and search results, but ONLY which belongs to this vitrine.
Because all categories and tags rendered by ONE template vitrina.php, then I should somehow to put this argument to search shortcode FROM file vitrina.php.
So I see this can be done, if I can put additional “boundary conditions” in your search shortcode.Are you understand my requests now? Maybe you need additional clarifying?
-
AuthorPosts