• Resolved steveraven

    (@steveraven)


    Hi Jason,

    I’ve been looking over the ‘Recent Search Terms’ (both widget and shortcode) and have decided to settle with the shortcode version as it’s easier to place on a page.

    However, a couple of questions:

    Is it possible to limit the amount of search terms to the ten or so latest ones?

    Also:

    Can the search terms have links added to them somehow so that nosey users (me included ?!?) can see at a glance what’s being searched for and the result of that search?

    Thanks for any help and info!

    • This topic was modified 5 years, 5 months ago by steveraven.
Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Jason Crouse

    (@coolmann)

    Hi @steveraven

    if you look at our knowledge base, you’ll find what you’re looking for (and more):

    https://slimstat.freshdesk.com/support/solutions/articles/5000631833-what-is-the-syntax-of-a-slimstat-shortcode-

    Specifically:

    limit_results allows you to determine how many records to display
    post_link can be used to display linked titles instead of permalinks

    So for example, in your case, the shortcode would be something like:

    [slimstat f="recent" w="post_link"]limit_results equals 10[/slimstat]

    I hope this helps,
    Jason

    Thread Starter steveraven

    (@steveraven)

    Excellent stuff, thanks Jason!

    I’d originally declined to use the above syntax as it didn’t appear to work – it shows ‘Pages and Posts’ rather than the ‘search terms’ used to find them.

    So I’ll still keep the original, but your shortcode will be added too!

    Thread Starter steveraven

    (@steveraven)

    Hi Jason,

    The above syntax doesn’t work after all.

    It just shows the last few pages and posts viewed by visitors, and if I happen to clear the cache, it resets to being empty until it’s re-populated.

    I remember now going into the syntax examples page and trying to find a likely candidate, but I couldn’t get anything to work that had the users actual search term, and a link back to the page/post that was subsequently found.

    • This reply was modified 5 years, 5 months ago by steveraven.
    Plugin Author Jason Crouse

    (@coolmann)

    My bad, I misread your original request. Replace post_link with searchterms:

    [slimstat f="recent" w="searchterms"]limit_results equals 10[/slimstat]

    Unfortunately Slimstat doesn’t currently support linking to search engine results pages connected to those keywords. The closest you could do is:

    [slimstat f="recent" w="referer"]searchterms is_not_empty #&&&limit_results equals 10[/slimstat]

    Jason

    • This reply was modified 5 years, 5 months ago by Jason Crouse.
    Thread Starter steveraven

    (@steveraven)

    Yes, I’m already using the first example (minus the limit_results bit as that doesn’t seem to work) on my website.

    Tried the second example and it just comes out with a load of gobbldegook if you get something like Yandex being the referrer.

    Ah well, just a thought – thanks Jason.

    Plugin Author Jason Crouse

    (@coolmann)

    Hi @steveraven

    strange that limit_results doesn’t work for you. Enabling Debug Mode in the settings should show you the SQL query that was used, and you should see the “LIMIT” clause in it.

    Yes, the second one is definitely not what you’re looking for. I will add your request to our wishlist for future consideration! Or you could write your own shortcode with a little help from a PHP developer ??

    Best,
    Jason

    Thread Starter steveraven

    (@steveraven)

    okey dokey – just make sure that anyone searching for a ‘red car’ in the search results with ‘bloody great big red car’ gets it linked to the ‘red car’ page, with his search term, so we can all have a laugh!

    Thread Starter steveraven

    (@steveraven)

    Hang on – think I’m on to something here.

    Just tried adding:

    [slimstat f=’recent’ w=’searchterms,post_link’][/slimstat]

    …and all of a sudden, loads of links, pages/posts, and more importantly pages/posts with LINKED SEARCH TERMS appeared!

    I’ll have a closer look when I get home!

    Plugin Author Jason Crouse

    (@coolmann)

    @steveraven ha! How come I didn’t think about that. You’re absolutely right, that’s brilliant! ??

    Thread Starter steveraven

    (@steveraven)

    Yes, all I need to do now is limit the search terms.

    That SQL query thing doesn’t seem to be working either – where does the query show up?

    Thread Starter steveraven

    (@steveraven)

    Got it – finally got the search terms limit working and it was a schoolboy error – I forgot that shortcodes should be added in the text editor, rather than the visual one.

    All up and running now, thanks Jason – methinks that white bar is calling!

    Plugin Author Jason Crouse

    (@coolmann)

    My bad, you’re right. The SQL debug code doesn’t show up on shortcodes for security purposes.

    Plugin Author Jason Crouse

    (@coolmann)

    Got it – finally got the search terms limit working and it was a schoolboy error – I forgot that shortcodes should be added in the text editor, rather than the visual one.

    Terrific! Nicely done, sir. Time to celebrate at that white bar! Haha.

    Take care,
    Jason

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Recent Search Terms’ is closed to new replies.