Skip Navigation

[Resolved] Cred Form Website URL submission and display

This support ticket is created 8 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 1 reply, has 2 voices.

Last updated by Beda 8 years ago.

Assisted by: Beda.

Author
Posts
#402449

In the single ad layout I would like to display the advertiser's submitted url and the advertiser's submitted contact number

In the cred form I use for submissions I am using the following code to capture the website url and phone number:

<li><label>[wpml-string context="cred-form"]Add Website[/wpml-string]</label>   
[cred_generic_field field='website' type='url' class='' urlparam='']
{
"required":0,
"validate_format":1,
"persist":1,
"default":"<em><u>hidden link</u></em>"
}
[/cred_generic_field]


</li></br>
<li><label>[wpml-string context="cred-form"]Add Contact Number[/wpml-string]</label>     
[cred_generic_field field='phone' type='phone' class='' urlparam='']
{
"required":0,
"validate_format":0,
"persist":0,
"default":""
}
[/cred_generic_field]


</li></br>

The following is the code I am using on the Ad-Single Layout:

<div class="row_information row_inline">
  <span class="row_label"> <span class="glyphicon glyphicon-arrow-right"></span>     [wpml-string context="wpv-views"]Website[/wpml-string] </span>
  <span class="row_value"> [types field="website-url" title="Website"][/types] </span>
</div>	
<div class="row_information row_inline">
  <span class="row_label"> <span class="glyphicon glyphicon-phone"></span>     [wpml-string context="wpv-views"]Phone[/wpml-string] </span>
  <span class="row_value"> [types field="phone"][/types] </span>
</div>	

When I was entering some sample listings I added them via the wordpress admin area and the website URL and phone numbers displayed correctly on the published listing.

However, when I submit a listing via the front end the website and the phone number are not displayed in the published advert.

I have tried replacing the code for the website in the cred form this:

[cred_generic_field field='website' type='url' class='' urlparam='']
{
"required":0,
"validate_format":1,
"persist":1,
"default":"<em><u>hidden link</u></em>"
}
[/cred_generic_field]

To this:

 [types field="website-url" title="Add A Website"][/types]  

But nothing displays in the cred form.

Am I doing something wrong with this code?

#402518

1. Your generic Field "website" has a different meta_key then the Field you are calling in your Website with the ShortCode.
That one uses "website-url", while you store values for meta_key "website".

2. Furthermore, you are calling the generic Fields as Types Fields, which will not work, not even if you enter them in the WP Admin.

To display Generic Fields (to edit them) in the WP Admin, you need to show Custom Fields in the Screen Options in your Post Edit Screen and enter the values there.

Then, you show them on the Front End by selecting the Fields from the GUI "Fields and Views" > Post Fields > your_field

It's the same process if you add the Field's values with CRED, also here you will need to use "Post Fields" and not Types fields

The ShortCode to display Post Fields looks like:

[wpv-post-field name='phone']

3. I am not entirely sure why you do not use Types Fields in your CRED form instead.
This approach is much simpler.
https://toolset.com/documentation/user-guides/using-custom-fields/

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