-
AuthorPosts
-
November 24, 2014 at 4:36 pm #356926
Hello,
I wish to change the results of the search function to say “Brands” instead of “Portfolio Items” is there a way to do this?
Here is an image of what I’m talking about:
November 24, 2014 at 11:42 pm #357223Hi atrifico!
Try line 9 in /enfold/includes/admin/register-portfolio.php.
'name' => _x('Portfolio Items', 'post type general name','avia_framework'),
Regards,
ElliottJune 24, 2020 at 2:48 am #1224985Hi,
Is there a way to do this without changing the code?
Maybe adding to the functions.php?
I’d like to change “Portfolio Items” to “Products” & “Posts” to “Projects & News” please.Thanks
AliceJune 26, 2020 at 2:14 pm #1225820Hi Alice,
Product is a post type added by the WooCommerce or some other e-commerce plugins. Do you need to change the types or just the titles?
Could you please attach a mockup of what you’re trying to achieve?
Best regards,
VictoriaJune 29, 2020 at 5:34 am #1226297Hi Victoria,
In private content is a link to sreenshots to explain the following:
1. Order of search results: Are there any settings to change the order of the search results so the closest match is the first and the least close match is last? In the example the search word “Stratopanel” shows the product (with the exact name) last in the results. I want it to show at top of the list please.
2. No result for some pages/2 : If I’m searching for a page title some don’t show in the results. ALL pages, posts, and portfolio items should show and be listed in closest match order from first result to last.
3. Change wording: I’d like the wording of the search result titles changed to: POSTS = Products & News. PORTFOLIO ITEMS = Products.
Let me know if you have any trouble with the link.
Thanks
AliceJune 29, 2020 at 5:01 pm #1226510Hi Alice,
Please have a look at the following threads:
If you need further assistance please let us know.
Best regards,
VictoriaJuly 3, 2020 at 12:58 am #1227602Hi Victoria,
Those threads didn’t really help me with what I need. One of the threads explained how to “have products display as the first section in the search results before posts and pages” but I need “portfolio items” to display first, is it just a matter of changing the code to ‘portfolio-items’ instead of ‘products’? (see code below)
/* Look for Products and place them at the start of the array */
if (array_key_exists(‘product’, $sorted)) {
$products_array[‘product’] = $sorted[‘product’];
unset($sorted[‘product’]);
$sorted = array_merge($products_array, $sorted);
}The other thread explained how to change the wording in the results when none are found but I just want to change the title names (which i don’t think a plugin can do). I explained what I’d like them to change to in point 3 in my last reply.
Thanks,
AliceJuly 8, 2020 at 3:00 pm #1228883Hi,
Thank you for the update.
We can use the avf_ajax_search_label_names filter to change the post type title. Usage examples can be found here:
// https://kriesi.at/support/topic/search-bar-8/#post-1003538
// https://kriesi.at/support/topic/change-products-wording-on-ajax-search-menu/#post-866050To sort the results by post type, try to use this snippet in the functions.php file.
function avf_order_search_by_posttype($orderby){ if (!is_admin() && is_search()) : global $wpdb; $orderby = " CASE WHEN {$wpdb->prefix}posts.post_type = 'portfolio' THEN '1' WHEN {$wpdb->prefix}posts.post_type = 'product' THEN '2' WHEN {$wpdb->prefix}posts.post_type = 'post' THEN '3' ELSE {$wpdb->prefix}posts.post_type END ASC, {$wpdb->prefix}posts.post_title ASC"; endif; return $orderby; } add_filter('posts_orderby', 'avf_order_search_by_posttype', 999, 1);
// https://codex.wordpress.org/Plugin_API/Filter_Reference/posts_orderby
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.