• Resolved Pocket Flan

    (@pocket-flan)


    I thought it’d be best to start a new thread instead of adding this to the other topic.

    Is there a way to show the text above search results like so: “Your search result for attribute_1, attribute_2, attibute_4, etc…”, showing all the options basically.

    As opposed to only showing the first attribute name when showing search results for multiple items? i.e; attibute_1

    Also, is there a way to choose a custom text or url for empty search results?

    https://wordpress.org/plugins/search-filter/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author DesignsAndCode

    (@designsandcode)

    Hey again Pocket Flan

    This is something I’ve been looking at for a while.

    So as I was saying before, your site uses the built in templates that come with your theme to display the results, so we have to modify those templates directly.

    Lets take the 2013 theme as an example, and examine the category.php template file it uses.

    To display the Category on the Category archive page the template file uses the following code to output its category:

    <?php printf( __( 'Category Archives: %s', 'twentythirteen' ), single_cat_title( '', false ) ); ?>

    the function single_cat_title will always display only one category, even if we are filtering by multiple categories.

    This seems like something that is inherently wrong with WP, as almost all different methods to obtain the current category will only ever return 1 category.

    (See my comment on Stack Exchange – http://wordpress.stackexchange.com/questions/18652/get-category-id-inside-category-template/115291#115291)

    So what we have to do, is use the wp_query object to return the URL parameter with the categories in it, and extract them from there.

    Place the following code at the top of category.php (inside the php tag) to output the categories as a comma seperated list:

    $categories = [];
    if(isset($wp_query->query['category_name']))
    {
    	$category_params = explode("+",esc_attr($wp_query->query['category_name']));
    
    	foreach($category_params as $category_param)
    	{
    		$category = get_category_by_slug( $category_param );
    		if(isset($category->cat_ID))
    		{
    			$categories[] = $category->name;
    		}
    	}
    	echo "<h2>Categories:</h2>";
    	echo implode($categories, ", ");
    
    }

    I guess from there you have all you need to integrate that with your template.

    I am looking at integrating this with the plugin but I’m not sure how I could hook in to different themes templates reliably and include this, or if I should provide a function that allows people to just drop it in to their template files… 😉

    Thread Starter Pocket Flan

    (@pocket-flan)

    You mentioned hooks; Woocommerce is a good candidate and a very popular plugin.

    How would you go about showing attributes as a comma separated list?
    The following links my be helpful: http://www.remicorson.com/customize-woocommerce-products-search-form/ and this one: https://searchwp.com/support/topic/are-you-running-woocommerce/

    Plugin Author DesignsAndCode

    (@designsandcode)

    Hi Pocket Flan

    This plugin is not fully integrated with WooCommerce, a premium version I’m building will have this support.

    This plugin is for filtering taxonomies, post date and post types.

    I think the product attributes are in fact post meta data, which this version doesn’t support :/

    If you’re interested in the premium version leave your email address here:
    http://www.designsandcode.com/contact-us-2/

    Hope to have it out in a few weeks.

    Thanks 🙂

    Thread Starter Pocket Flan

    (@pocket-flan)

    I’ll keep an eye for it, thanks.

    Thread Starter Pocket Flan

    (@pocket-flan)

    PS: On a side note, your plugin works fine with Wocommerce as it is.

    Plugin Author DesignsAndCode

    (@designsandcode)

    Hey Pocket Flan

    Yes this works with WooCommerce Tags & Categories, I should have said the new version will be better integrated 🙂

    You will be able to filter your results by min/max price range, order them by price range or order them by popularity and a load of other new cool features that allow manipulation of meta data!

    Thread Starter Pocket Flan

    (@pocket-flan)

    I can wait 😛

    Sarhjan7

    (@sarhjan7)

    I am loving your plugin! I am hoping you can help me with a final detail. I am using your plugin to search just taxonomies. I would like to display the same as Pocket Flan above, but am not sure how to do so with just taxonomies being searched.

    Thread Starter Pocket Flan

    (@pocket-flan)

    Hi Sarhjan7,

    Welcome to the club 😉

    I want to save you time and tell you that this would have to be a custom / paid job (based on our conversation with the developer), it’s not going to happen not even on the premium version of the plugin.

    Thank you
    Pocket Flan,
    The most delicious flan in the galaxy

    Plugin Author DesignsAndCode

    (@designsandcode)

    Hey Pocket Flan and Sarhjan7

    This is incorrect, the premium version will definitely have this, however just not on initial release – its all just a roadmap of development and ticking off various functionality which is heavily influenced by user requests 🙂

    Thanks

    Sarhjan7

    (@sarhjan7)

    Thanks for the feedback. Hoping this will be featured in an upcoming version… more incentive for me to purchase in the future even if not for this project.

    Thread Starter Pocket Flan

    (@pocket-flan)

    Ah, sorry I misunderstood.

    This what I would like to see:

    1) Ajax auto refresh, as mentioned before, but without auto submit. So, in that case you narrow down the search and see the result in real time, you hit submit when you are ready / happy with the results, THEN you load the page and pull the content (without Ajax).

    Because I have tested some “Ajax” search plugins and they break some components, as they update the page in real time, as opposed to updating the search result as mentioned above. Hope that makes sense, sorry not too easy to explain.

    In few words, ajax the plugin / search result within the plugin only, NOT the page.

    Can’t wait for it – when is this happening?

    Pocket Flan,
    The most delicious flan in the galaxy. Period.

    Plugin Author DesignsAndCode

    (@designsandcode)

    Let me get the initial version of the premium plugin out and then I can start to plan the roadmap and give time estimates.

    Currently the initial version is almost done, but we are also redoing our website in order to be able to sell the plugin, provide our own support forums and a lot of other general headache that needs to be set up before we begin selling our first premium plugin! :@

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Better text for search results’ is closed to new replies.