Skip Navigation

[Resolved] In search result page, form not displaying

This support ticket is created 6 years, 5 months 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 26 replies, has 3 voices.

Last updated by Shane 6 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#918961

There were two thing. One was for "s" which I tried [cred_field field="weight" post="package" urlparam="weight"] and it worked. I filled urlparam with "s".
But there is something another one also $tt->name... It's no where in URL at all. It's only in the page in php.
That's why I was asking if can make $tt->name to shortcode and I use that shortcode in value of another field..
Thanks

#918968

I think, I am not able to explain my question well.
Here it is.
As you said, I tried
Worked in one field where I put "s" in urlparam...
[cred_field field='your-field-of-interest-search' post='sprofile-searh' value='' urlparam='s' class='form-control' output='bootstrap']

What I put in another filed which is not in url
[cred_field field='where-to-study-search' post='sprofile-searh' value='' urlparam='' class='form-control' output='bootstrap']
But, where the form is displaying, there is one code $tt->name which I want to show filled in this field.

This is my real question.

Hope you got, what I am trying to say.

Here is the full code below

<style>
.form-group p{
margin:0;
padding:0;
}
</style>
[credform class='cred-form cred-keep-original']
<h4>Send a request</h4>
[cred_field field='form_messages' value='' class='alert alert-warning']
<div class="row">
<div class="form-group col-sm-4">
<label>Your Name</label>
[cred_field field='post_title' post='sprofile-searh' value='[wpv-user field="user_firstname"] [wpv-user field="user_lastname"]' urlparam='' class='form-control' output='bootstrap']
</div>

<div class="form-group col-sm-4">
<label>Your Email</label>
[cred_field field='your-email-search' post='sprofile-searh' value='[wpv-user field="user_email"]' urlparam='' class='form-control' output='bootstrap']
</div>

<div class="form-group col-sm-4">
<label>Your phone</label>
[cred_field field='your-phone-number' post='sprofile-searh' value='' urlparam='' class='form-control' output='bootstrap']
</div>
</div>
<div class="row">
<div class="form-group col-sm-4">
<label>Where to study</label>
[cred_field field='where-to-study-search' post='sprofile-searh' value='' urlparam='' class='form-control' output='bootstrap']
</div>

<div class="form-group col-sm-4">
<label>Your field of interest</label>
[cred_field field='your-field-of-interest-search' post='sprofile-searh' value='' urlparam='s' class='form-control' output='bootstrap']
</div>

<div class="form-group col-sm-4">
<label>When to study</label>
[cred_field field='when-to-study-agency' post='sprofile-searh' value='' urlparam='' select_text='--- not set ---' class='form-control' output='bootstrap']
</div>
</div>
<div class="row">
<div class="form-group col-sm-12">
<label>Your Message</label>
[cred_field field='your-message-search' post='sprofile-searh' value='' urlparam='' class='form-control' output='bootstrap']
</div>
</div>
[cred_field field='form_submit' value='Submit' urlparam='' class='btn btn-primary btn-lg' output='bootstrap']

[/credform]

Now for example at hidden link

There COURSE - TESTSEARCH & COUNTRY - AUSTRALIA
TESTSEARCH is in 1st field where I put "s" as you said and it worked

but in another field, there is country name which is "$tt->name" and there it is Australia in example, there is flag also which is using just $tt->name.png... Hope you got what I am telling actually.

#919003

That's why I was asking if can make $tt->name to shortcode and I use that shortcode in value of another field.
There's no way to use a PHP variable directly like this. You can create any custom shortcode that returns the name, and use that in the field value. Here's the documentation for creating custom shortcodes: https://codex.wordpress.org/Shortcode_API

Here is an example:

function get_tt_name_func($atts) {
  // defaults
  $a = shortcode_atts( array(
      'var1' => 0,
      'var2' => 0
  ), $atts );
  
  // use the shortcode attributes to create the name
  $name = 'post ' . ($a['var1'] + $a['var2']);

  return $name;
}
add_shortcode("get_tt_name", "get_tt_name_func");
[get_tt_name var1="3" var2="5"] prints: post 8
#919007

Then any solution for this so that I can print $tt->name value with any way in the field of "Where to study" textfield?
If yes, please give me clear one solution. I just need to display that one in the filed, that's it.. All other is ok
thanks

#919020
<?php 
function get_tt_name_func($atts) {
  // defaults
  $a = shortcode_atts( array(
      'var1' => $tt->name,
  ), $atts );
   
  // use the shortcode attributes to create the name
  $name = 'Post '.($a['var1']);
 
  return $name;
}
add_shortcode("get_tt_name", "get_tt_name_func");

echo do_shortcode('[get_tt_name var1]')

 ?>

This one I tried but it's printing only "Post"

#919042

If yes, please give me clear one solution.
No, you must write custom code. I can show you where to find the documentation for it, but I cannot write it for you. If you need professional assistance with this code, we have a portal available where you can connect with skilled developers who may be able to assist you.
https://toolset.com/contractors

#919116

I don't have much time and money for doing this. I am little bit in hurry.
Can help be done in another way? LIke I want a php form on search result page. I mean, what toolset form is doing, same thing can be done by that php form. And I think, in that php form, I can use this $tt->name in value directly, and won't need to make any shortcode...

#920077

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

As Christian is currently on vacatio, i'll be handling this ticket.

The php form that you want on this search page. What should it do? I see that you have created a CRED form. Is it that you want this form to be used as a search ? Because CRED forms are meant to create posts.

Please update me and I'll see how best I can assist from where christian left off.

Thanks,
Shane

#920194

Hello Shane
Thanks a lot for your reply
Yes, it's for front end post.
It's on search result page, when someone do search for anything with taxonomy, On search result page, it show,
you have search for xyz in abc.. Here xyz is searched text and abc is taxonomy.

I have a request form there which create a post. and in form there are two fields, one is for searched text and one is for taxonomy.

This is main thing. Hope you got it

Thanks

#920919

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Getting this correctly.

You want to pre-populate the fields with the search terms.

What you can use is this shortcode.
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term

You can use this shortcode to get the search term. Then you can pass the shortcode as a value attribute for the field in your CRED form and it should auto-populate the field for you.

Thanks,
Shane

#922918

Hi
Please read my all message again.
I need to show the taxonomy which is in search. Which we choose while searching.
Hope you don't mind my language but it's like I am fully tired... Another man who was before you, instead of helping out, he was forcing to buy someone else's services.
It's your plugin mate, you should give support, right?
Please read the messages above and see how irritating it was. 1st I was wanted it in popup, which didn't done but done just by printing out of popup. Then another issue which was to display choosen taxonomy and for that, was forcing to buy another person's service. As I said before, I don't have much money and time and that man did lots of timepass
Please don't mind my language. I am bit fedup from service... Please try to find the solution.

Thanks

#923059

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

That's certainly understandable. Usually we recommend to contact our registered contractors for work that involves custom coding as this goes beyond our support scope. This usually entails stuff that our plugins are not able to do natively.

Right now you say you need to show the taxonomy that was searched for. For this you need to use this shortcode below.
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term

Its able to get the term that you've searched for and printed out on the page.

Please let me know anymore information that you would like to know and i'll be happy to assist in anyway I can.

Thanks,
Shane