Skip Navigation

[Resolved] Adding Twitter feed and contact form to content template

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

Problem:

The customer asked how to add a dynamic Twitter feed linked to the custom field and a contact form to the content template

Solution:

For the Twitter feed, shared information of how Twitter's embed code works and how Toolset's Types field shortcode can be included in it to make it dynamic.

And for the contact form suggested adding a new CPT "Contact Requests" and then collecting new submissions using the Toolset post form.

Relevant Documentation:

https://publish.twitter.com

https://toolset.com/course-chapter/forms-for-front-end-submission-and-editing-of-directory-items/

This support ticket is created 2 years, 2 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.

Our next available supporter will start replying to tickets in about 0.37 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by ianC-8 2 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#2255673

Tell us what you are trying to do? We would like to display a Twitter feed (based on the listing's entered Twitter account) and a contact form (linking to the listing's email address) within a content template.

Is there any documentation that you are following? I have checked your support documentation but can't see any reference to this - sorry if I have missed anything!

Is there a similar example that we can see? The form and feed would be in the right side-bar of a listing like this, appearing under the map. hidden link?

What is the link to your site? hidden link?

#2255803

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

The embed code for the Twitter feed/timeline from Twitter's website ( hidden link ) looks like this:


<a class="twitter-timeline" data-height="600" data-theme="light" href="<em><u>hidden link</u></em>">Tweets by androidcentral</a>
<script async src="<em><u>hidden link</u></em>" charset="utf-8"></script>

Note: In this example code the Twitter account used for the timeline is "androidcentral".

You can make this code dynamic by linking the Twitter account part to a custom field value, so that a different timeline can be shown for each listing.

1. You'll add a new "Twitter Account" single-line type custom field with listing post type (slug "twitter-account"), in which the Twitter account value ( e.g. androidcentral ) can be saved.

2. Next, in your content template for listings, you can include a "Custom HTML" block to add this embed code, with the Toolset Types field shortcode, like this:


<a class="twitter-timeline" data-height="600" data-theme="light" href="<em><u>hidden link</u></em> field='twitter-account'][/types]?ref_src=twsrc%5Etfw">Tweets by [types field='twitter-account'][/types]</a>
<script async src="<em><u>hidden link</u></em>" charset="utf-8"></script>

As for the contact form, you can register a new custom post type "Contact Requests" to collect contact form submissions and then create a new form to add posts to this post type, using Toolset Forms. Here is a guide on using the Toolset Forms:
https://toolset.com/course-chapter/forms-for-front-end-submission-and-editing-of-directory-items/

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2257697

My issue is resolved now. Thank you!

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