Skip Navigation

[Resolved] I wan’t to remove the searchbutton in a Views-search

This thread is resolved. Here is a description of the problem and solution.

Problem:
Remove search button from view to display glossary view

Solution:

You can find proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/i-want-to-remove-the-searchbutton-in-a-views-search/#post-630505

Relevant Documentation:

This support ticket is created 6 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 6 replies, has 2 voices.

Last updated by kristenM 6 years ago.

Assisted by: Minesh.

Author
Posts
#630379

Is there any way that I can eliminate the searchbutton-function?
Christian Cox told me following in another thread:
"You can eliminate the search button by creating a list of links that include the correct URL parameters. If you would like to create a separate ticket to address this once the rest of the View is functioning as expected, we can discuss the modifications that would be required."

I am trying to make a search-engine that searches the first letter in the title of a post. The problem is, that when I choose a letter, I afterwards will have to click the search-button to execute the search. I would like the search to execute when I click one of the letters indstead.

Link to the search-engine: hidden link

I am confident that Christian Cox - or any of the Toolset team can help with a working solution.

Thank you in advance.

Kind regards

Kristen Mathiasen

#630505

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Yes - what Christian Cox has advised is correct - you should build your characters as links with URL param.

I've modified the shortcode [wpv-heading-aux] as given under:

add_shortcode('wpv-heading-aux', 'wpv_heading_aux');
function wpv_heading_aux($atts, $content = '') {
  static $heading = null;
  static $index = 0;
  extract( shortcode_atts( array(
        'condition' => '',
        'value' => '',
    ), $atts ) );
  $index++;
  $letter = strtoupper(substr($value,0,1));
  $output = '';
  if ($heading != $letter) {
    $heading = $letter;
    if ($index > 1) {
        $output = '</li>';
    }
    $output .= '<li data-letter="' . $letter . '"><a href="?wpv_post_search='.$letter.'">' . $letter.'</a>';
  }
  return $output;
}

Where I've added anchor link and passed the URL param "wpv_post_search". Now, when you click on the character it will load the associated results with character as expected and you are free to remove the search button now.

#630698

Hi Minesh.

Thank you for your quick reply.

I'm sorry but I have to know exactly where to put this code. Is it in one of the Views I've created (with massive help from Christian 😉 or is it in some kind of PHP or Javascript?

Afterwards I need to know where to put the shortcode in order to activate it.

Thank you in advance.

I wish you a very pleasant day.

Kind regards

Kristen

#630855

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - you do not need to add that code anywhere as it's already added and configured.

Please check your link - click on characters and you will see your desired output.
=> hidden link

#631144

Hi Minesh.

That is really great. Thank you very much. I can see no that it is working for the single letters.

It unfortunately doesn't work for ALL (also called "Alle") I have tried different ways to put the shortcode around the code:

1 [wpv-layout-start]
2 [wpv-items-found]
3 <!-- wpv-loop-start -->
4 <ul id="wpv_heading_tab" style="display:none;">
5 <li data-letter="">Alle
6 <wpv-loop>
7 [wpv-heading-aux condition="letter" value="[wpv-post-title]"][/wpv-heading-aux]
8 </wpv-loop>
9
10 <!-- wpv-loop-end -->
11 [/wpv-items-found]
12 [wpv-no-items-found]
13 [wpml-string context="wpv-views"]Intet resultat - prøv igen[/wpml-string]
14 [/wpv-no-items-found]
15 [wpv-layout-end]

I have tried it different places in line 4 and 5 but haven't been able to find the right place to put [wpv-heading-aux...]

Can you help me with this?

Thank you in advance and kind regards.

Kristen

#631489

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've adjusted your view's content as given under for Alle button:

  <li data-letter="all"><a href="/liste-tjek">Alle</a></li>

I can see its working fine now. Could you please confirm.

#631624

Dear Minesh.
Thank you so much for your quick help. It has made my work so much easier.
Kind regards.

Kristen

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.