• Resolved jasonridesabike

    (@jasonridesabike)


    Hi Shane, great plugin!

    I was wondering if there’s some clever way of displaying the query in the results.

    Like maybe I could have 1 echo for the taxonomy query and 1 for a keyword query and then make a control flow to print whatever the situation necessitates. Like “Search results for “BLAHBLAHBLAH” of the taxonomy “Monkey Pants”.

    But for the life of me I can’t figure out from where to grab this info. I am not a PHP narwahl yet. More of a PHP donkey working my way up.

    Anyway if you could tell me how to query the strings I will write up a nifty control flow and even send that back to you if you like that kind of thing.

    Thanks!

    https://www.ads-software.com/plugins/advanced-custom-post-search/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Creare

    (@shane-welland)

    Yes, potentially this could be something that you could do with some editing. I’ll try to give you some snippets later today when I get a chance to have a fiddle. really appreciate the question too, perhaps an oversight on the original development =(!

    Thread Starter jasonridesabike

    (@jasonridesabike)

    dood bro, I figured it out and wrote a function to handle the behaviour.

    Just add the function then put portfolio_search_results() in the template where you want to display the stuff

    I am now a wordpress turkey.

    Edit note: I left in the values I used, because why not. But whoevers reading this should use $_POST(whateveryourcustomtaxisnamed).
    Double edit note: This is for a search of keyword + custom tax, keyword, or custom tax. You could use the same setup in expanding to include more terms.

    // Function to handle the ‘showing results’ header on the advanced search page:
    function portfolio_search_results(){
    if ($_POST[keywords] && $_POST[property_types]){
    echo “searching for ‘$_POST[keywords]’ in the category: ‘$_POST[property_types]'”;
    } elseif ($_POST[keywords]) {
    echo “searching for ‘$_POST[keywords]’ in all categories”;
    } elseif ($_POST[property_types]) {
    echo “Showing all properties in the $_POST[property_types] category”;
    } else {
    echo “Showing all”;
    }
    }

    Thread Starter jasonridesabike

    (@jasonridesabike)

    I would be super stoked to write a more general function for inclusion into the plugin; I’m super into learning PHP and wordpress right now.

    Plugin Author Creare

    (@shane-welland)

    =D Glad you got something working, it’s quite late here so I’ll be taking a look after I wake up but I’ll see if I can get a quick patch in to handle this functionality for you :). Congratz!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Displaying the query in the header of the results page’ is closed to new replies.