How to import XML files into WordPress posts with CyberSEO Pro

How to import XML files into WordPress posts with CyberSEO Pro

CyberSEO Pro is a powerful syndication plugin for WordPress that can streamline your content curation process. One of its outstanding features is the ability to import XML files and automatically generate WordPress posts from them. With CyberSEO Pro you can save XML tag values as custom WordPress post fields and use these values in the Post Title, Post Content and Post Excerpt template fields.

This guide will walk you through the step-by-step process of using these features. We will use real-world examples to show you how to set up HTML templates and WordPress custom fields for your XML files.

Step 1: 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, suppose we have an XML file containing product information:

<item> <ProductId>1005001541622107</ProductId> <Image_Url></Image_Url> <Video_Url></Video_Url> <Product_Desc>Orignial Xiaomi Mi Wireless Dual-Mode Mouse&lt;/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></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.

Step 2: 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, where name should be replaced with the actual custom field name.
  • %xml_tags[name]%: This represents an XML tag value, where name 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):

Orignial Xiaomi Mi Wireless Dual-Mode Mouse

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. Enjoy CyberSEO Pro, your tool for effortless content syndication!


You might also like this video