artkom
Forum Replies Created
-
Yes, this is the solution.
The post can be closed as resolved.Thank you so much!
$query->set( 'cat', '-135' );
This is an id of excluded category. And I want to use post ID’s (NOT category id) for shortcode.
Thank youSorry for the delay. Sure here is it:
function exclude_category( $query ) { if ( $query->is_home() ) { $query->set( 'cat', '-135' ); } if ( $query->is_category ) { $queried_object = get_queried_object(); $child_cats = (array) get_term_children( $queried_object->term_id, 'category' ); if ( ! $query->is_admin ) //exclude the posts in child categories $query->set( 'category__not_in', array_merge( $child_cats ) ); } return $query; }Here is an example of my shortcode:
[display-posts id="5982, 7072, 5542, 31" image_size="thumbnail" exclude_current="true"]The code above is showing only the one post (31). It belongs to the category “vendors”.
All other posts are not showing (5982, 7072, 5542). These posts are from the “industry” category that was excluded from the main page with exclude_category() function
I hope it’ll help to sort it out… Please let me know if you need any other information. Thank you
Yes it’s not working when I’m tryind to show posts per ID’s (not categories ID)
Still not working (
Forum: Plugins
In reply to: [WP Store Locator] Locator Search from another page@bobquznie No. I don
t have this problem. Maybe you have double this form in store locators page (if you place search form in header, and main form on page)? Then try delete added form on store locator`s page. Or fix this like set display:none for added formForum: Plugins
In reply to: [WP Store Locator] Locator Search from another page@tenkepadu Yes. You can place search form for store locator on any page. When visitor is searching store in this form the system redirecting visitor on locator`s page with results.
Forum: Plugins
In reply to: [WP Store Locator] Locator Search from another page@tijmen Smit Thank you so much. I`m slowpoke )
I`m finally find a solution!. Its a really simply.
Here the code for index page with input form for store localor:
<input autocomplete="off" id="wpsl-search-input-home" type="text" value="test" name="wpsl-search-input"><input id="wpsl-search-button-home" type="submit" value="Search">Forum: Plugins
In reply to: [WP Store Locator] Search from another pagePlace this in default.js o main.js of your theme.
But what code should be on the front page?
Forum: Plugins
In reply to: [WP Store Locator] Search from another pagehttps://wordpress.org/support/topic/how-to-add-a-search-inputbutton-to-my-home-page?replies=9
I found this thread described solution. But I do not understand what should be the very form of the home page.
<div> <div class="wpsl-input"><input id="wpsl-search-input1" autocomplete="on" type="text" value=""></div> <div><a>Locate</a></div> </div>Example INPUT on the link does not work unfortunately.