CyberSEO Pro is a universal syndication plugin for WordPress designed to turbo-charge your content curation process. This powerful plugin excels in its ability to import various content sources and seamlessly generate WordPress posts from them. However, what really sets CyberSEO Pro apart is its universal use of XML as the primary content format. Whether your source is in JSON, CSV, text dumps, or even directly from social network feeds, CyberSEO Pro is programmed to automatically convert it into an XML format for easy manipulation and integration into your WordPress site.
This feature is critical because XML is a versatile and widely accepted format. RSS and Atom feeds, common content sources for many websites, are special instances of XML and therefore easily compatible with the plugin. Therefore, knowing how to work with XML within CyberSEO Pro gives you the ability to handle just about any content source. This conversion process is invisible to you – there’s no need to get your hands dirty with the original JSON, CSV or other source structures. Instead, you interact only with the XML version, simplifying your user experience and increasing your productivity.
In this comprehensive guide, we’ll show you how to save XML tag values as custom WordPress post fields, how to use these values in post templates, and how to set up HTML templates and WordPress custom fields for your XML files. Real-life examples will be used to ensure practical understanding so you can harness the full power of CyberSEO Pro for your content syndication needs.
Saving XML Tags as WordPress Custom Fields
CyberSEO Pro allows you to save XML tag values as custom fields for your WordPress posts. To do this, you need to specify which XML tags will be imported as post custom fields in the “Custom Fields” text box in a specific format:
xml_tag_name->custom_field_name
For example, if you import this CSV product file from the AliExpress affiliate program, it will be converted into the following XML document containing product information:
<item> <ProductId>1005001541622107</ProductId> <Image_Url>https://ae04.alicdn.com/kf/He901c3b3a5744dae99e567764ad9ad78z.jpg</Image_Url> <Video_Url></Video_Url> <Product_Desc>Orignial Xiaomi Mi Wireless Dual-Mode Mouse</Product_Desc> <Origin_Price>USD 17.59</Origin_Price> <Discount_Price>USD 13.90</Discount_Price> <Discount>21%</Discount> <Currency>USD</Currency> <Commission_Rate>3</Commission_Rate> <Commission>USD 0.42</Commission> <Sales180Day>481</Sales180Day> <Positive_Feedback>98.4%</Positive_Feedback> <Promotion_Url>https://s.click.aliexpress.com/e/_DEJRT0Z</Promotion_Url> </item>
We can map these XML tags to WordPress custom fields like so:
Origin_Price->_regular_price Discount_Price->_price Image_Url->thumb Product_Desc->%post_title%
After importing the XML file, the WooCommerce product custom fields _regular_price
and _price
, WordPress post title and the CyberSEO Pro thumb
custom field will be populated with the corresponding values from the XML tags.
Using XML Tags and Custom Field Values in HTML Templates
CyberSEO Pro enables you to use XML tag values and custom field values as shortcodes within your “Post title”, “Post content”, and “Post excerpt” template boxes. This means you can set up your own HTML post layout and insert these values where needed.
The shortcodes are as follows:
%custom_fields[name]%
: This represents a custom field value, wherename
should be replaced with the actual custom field name.%xml_tags[name]%
: This represents an XML tag value, wherename
should be replaced with the actual XML tag name.
For example, let’s create a post template for our product XML file:
<h2>%xml_tags[Product_Desc]%</h2> <img src="%xml_tags[Image_Url]%" alt="%xml_tags[Product_Desc]%" /> <p><strong>Original Price</strong>: %xml_tags[Origin_Price]%</p> <p><strong>Discounted Price</strong>: %xml_tags[Discount_Price]% - You save %xml_tags[Discount]%</p> <p><strong>Sales in last 180 days</strong>: %xml_tags[Sales180Day]%</p> <p><strong>Positive Feedback</strong>: %xml_tags[Positive_Feedback]%</p> <p><a href="%xml_tags[Promotion_Url]%" target="_blank">Buy Now</a></p>
This template will create a post with the product image at the top, followed by the product description and various details like the original price, discounted price, sales information, positive feedback, and commission rate. At the end, there’s a “Buy Now” button that links to the product’s URL.
Please note that the %xml_tags[tag_name]%
shortcode is used to insert the value of the corresponding XML tag into the post content. Replace tag_name
with the actual name of the XML tag from your feed. In this case, the generated post may look like this (depending on your WordPress theme):
Once you’ve set up your templates and mapped your custom fields, you’re ready to start importing XML files and converting them into WordPress posts. CyberSEO Pro does all the heavy lifting for you, making it a breeze to populate your site with high quality, structured content.
Remember, the examples given here are just that – examples. The beauty of CyberSEO Pro is its flexibility, allowing you to map any XML tags to any custom fields and then use them within your templates as you see fit. So whether you’re importing products, news articles, reviews, or any other type of XML-based data, you have complete control over how your posts look and where the data is placed.
Manual XML Section Tag Selection
While CyberSEO Pro excels in automatically detecting and importing XML section tags – like <item>
and <entry>
for RSS and Atom feeds – some XML files may have complex, nested structures that make automatic detection challenging. To ensure optimal performance and flexibility, CyberSEO Pro provides an option for you to manually specify XML section tag names that the plugin should parse.
Located on the “Expert” tab of the CyberSEO Pro feed options page, the “XML section names” box is your go-to tool for such cases. Here, you can enter a comma-delimited list of XML section tag names that you want the plugin to target. This can be a single tag name such as <PRODUCT>
or <ARTICLE>
, or a list of multiple names depending on your XML structure.
For example, consider an XML feed structure where <ARTICLE>
sections are nested within <CATEGORY>
sections:
<category> <article> <title>Article 1 Title</title> <content>Article 1 Content</content> </article> <article> <title>Article 2 Title</title> <content>Article 2 Content</content> </article> </category>
In this case, you would input <ARTICLE>
into the “XML section names” box to directly target the individual articles nested within each category.
By utilizing this feature, you gain further control over which specific sections of your XML feed CyberSEO Pro parses, allowing for accurate and tailored content import regardless of the complexity or uniqueness of your XML structure. This enhancement underlines the flexibility and user-centric design of CyberSEO Pro, making it an even more potent tool in your content syndication arsenal.
Remember that the process of choosing XML section names requires a basic understanding of your XML feed’s structure. However, once you’ve determined the appropriate sections to target, CyberSEO Pro streamlines the rest of the process, effortlessly converting your XML content into engaging WordPress posts.
Import RSS, XML, JSON, CSV and HTML as WooCommerce products with CyberSEO Pro
Source: https://www.cyberseo.net/blog/how-to-import-xml-files-into-wordpress-posts-with-cyberseo-pro/