As a senior Anqi CMS website operation staff, I know that in the digital age, diversified communication methods are the key to connecting users and enhancing user experience.AnQi CMS offers great flexibility in this aspect, whether it is built-in contact information or custom social media channels, it can easily help your website establish contact with visitors.
I will introduce to you in detail how to add and call custom contact methods in Anqi CMS, such as WhatsApp and Facebook.
Understanding the contact information management of AnQiCMS
The Anqi CMS backend management system is committed to providing a comprehensive and flexible content management solution, among which the "Contact Information Settings" feature is one of its highlights.It not only provides common contact information settings such as contacts, contact phone numbers, contact addresses, contact email addresses, WeChat IDs, and WeChat QR codes, but also allows operators to freely expand and add more customized contact channels according to their own needs.This is undoubtedly a powerful tool for businesses that need to connect with global users or provide multi-platform services.
Add custom contact information in the Anqi CMS backend
To add WhatsApp, Facebook, or any other custom contact information you wish to display, you need to log in to the Anqi CMS backend management interface to perform the operation.
First, please log in to your Anqi CMS backend. In the left navigation menu, find and click "Backend Settings", then select "Contact Information Settings".
After entering the contact information settings page, you will see a series of default contact information entry boxes.At the bottom of the page, there is usually an area for "Custom setting parameters".This is the area where we add non-standard contact methods.Click the Add or corresponding Edit button, and you will see three key fields:
- Parameter name:This is the unique identifier you use when calling this contact method in the website template.To ensure ease of identification and invocation, it is recommended to use alphabets for naming, for example, set 'WhatsApp' for WhatsApp, and 'Facebook' for Facebook.The AnQi CMS automatically converts letters to camel case naming (i.e., the first letter of each word is capitalized, with no spaces in between), but it does not affect the use of the parameter names you enter directly in the template.
- Parameter value:This is the specific content of the contact information. For example, for WhatsApp, you can enter your WhatsApp number, or a WhatsApp chat link containing the number (such as
https://wa.me/您的电话号码)。For Facebook, you can enter the link to your Facebook homepage (such ashttps://www.facebook.com/您的主页名称) - Note:This field is only used by backend administrators to identify and record the purpose of this parameter, and will not be displayed in the front-end template.You can fill in information such as "WhatsApp link at the bottom of the website" or "Customer service Facebook page" for future maintenance and management.
After completing the form, save your changes. In this way, your custom contact information has been successfully added to the Anqi CMS backend database.
Call custom contact information in the website template
Once the custom contact information is set up in the background, the next step is to display it in your website's frontend template. Anqicms provides a special template tag for this.contact.
contactThe label usage is{% contact 变量名称 with name="字段名称" %}. Among them,nameThe value of the parameter is the 'parameter name' you fill in the 'Custom Settings Parameters' on the back end.
Here is an example of code to call WhatsApp and Facebook contact information:
If you have set the contact information named "WhatsApp" and "Facebook" in the "Custom Setting Parameters" in the background, and entered the corresponding link or number in the "Parameter Value", you can use the following code to call them at any location in the template:
{# 直接调用WhatsApp联系方式 #}
<div>
<span>联系WhatsApp:</span>
<a href="https://wa.me/{% contact with name="WhatsApp" %}" target="_blank" rel="nofollow">
{% contact with name="WhatsApp" %}
</a>
</div>
{# 将Facebook链接赋值给变量后调用 #}
{% contact facebookLink with name="Facebook" %}
{% if facebookLink %}
<div>
<span>访问我的Facebook主页:</span>
<a href="{{ facebookLink }}" target="_blank" rel="nofollow">
Facebook
</a>
</div>
{% endif %}
In the above code:
{% contact with name="WhatsApp" %}The value set for the "WhatsApp" parameter in the background will be directly output. You can embed it intohrefIn the attribute, to create a clickable WhatsApp chat link.{% contact facebookLink with name="Facebook" %}Assign the parameter value of Facebook tofacebookLinkA variable, which is very useful when you need to further process or judge data. Through{% if facebookLink %}Check if the variable exists, it can avoid blank links or errors on the page when the background is not set.target="_blank" rel="nofollow"The attribute is usually used for external links to ensure that a new tab is opened without leaving the current website, and to inform the search engine not to track this link, which helps with SEO.
You can place these code snippets in the header, footer, contact us page, or any area where you want visitors to see these contact methods.In this way, the flexibility of Anqi CMS allows your website to easily integrate various custom social and communication channels, thereby better serving your visitors and business needs.
Common questions
Q1: How do I add a contact method outside of the default list of anqicms, such as Telegram or Skype ID?
You can use the "Custom Settings Parameter" feature in the "Contact Information Settings" to achieve this.Just add a custom parameter on the “Contact Settings” page in the background, set the “Parameter Name” to “Telegram” or “SkypeID”, and then enter your Telegram username or Skype ID in the “Parameter Value”.In the template, you can use{% contact with name="Telegram" %}or{% contact with name="SkypeID" %}Call this information.
Q2: Under the AnQi CMS multi-site management mode, can I set different custom contact information for different websites?
Yes, AnQi CMS supports multi-site management, and the contact information settings for each site are independent.You can configure the contact information separately for each site's backend, including default items and custom parameters.When calling in the template,contactThe label will default to retrieving the contact information of the current site, if you need to cross-site