WordPress users frequently leverage the robust capabilities of the CyberSEO Pro plugin for content syndication. Often it is necessary to modify or remove certain parts of the imported HTML pages. CyberSEO Pro comes with a set of powerful tools to perform these modifications seamlessly and efficiently. This article will guide you through the main features of the plugin and demonstrate how to use them to customize imported content.
Removing HTML Tags
CyberSEO Pro has a special setting called HTML tags to strip. Conveniently accessible from the “Advanced” tab of the feed settings page, this feature makes it easy to remove unwanted HTML tags from the generated posts. For example, you can enter a comma-separated list of HTML tags to omit: h1, img, script, style
.
The use of this feature extends beyond mere text decoration elements such as <strong>
, <em>
, <div>
, <span>
, and others. It empowers users to cleanse their text of links or eradicate entire HTML blocks, like <img>
, <style>
, <script>
, and the like, inclusive of their internal content.
Removing Specific HTML Blocks
For more targeted modifications, the Remove outer HTML elements feature can be used. This allows you to remove particular HTML blocks from the imported content. Block elements intended for removal can be added to the box in a semicolon-separated list, each expressed as the tag name along with attribute-value pairs in JSON format.
For instance, if you want to remove all <div>
elements with the attribute class="comment"
and all <p>
elements with attributes class="description"
and id="block"
, the following should be entered:
div {"class": "comment"}; p {"class": "description", "id": "block"}
Suppose you syndicate articles that include a block of HTML code representing a share section within a <div>
element with the class attribute set to "share-box"
:
<div class="share-box"> <!-- Share icons and content here --> </div>
To remove this share section from your imported content, you can simply add the following rule to the “Remove outer HTML elements” box:
div {"class": "share-box"}
By entering the above rule into the “Remove outer HTML elements” box, any <div>
element with the class attribute set to “share-box” will be removed from the post content. Remember to accurately specify the tag names and attribute-value pairs in JSON format, separated by a space, to effectively remove the desired HTML elements.
Built-in Synonymizer/Rewriter
The plugin’s built-in Synonymizer/Rewriter further enhances flexibility by allowing the replacement or removal of words, phrases, or parts of the HTML code as per a user-defined synonym table.
The Synonymizer requires you to populate the “Global synonym table” with pipe-delimited synonym entries. These entries can then be used to “spin” content in various ways. If the synonym table has entries like
nature|god|the Universe hates|abhors vacuum|emptiness kitty|cat|kitten
In this case an original phrase such as “Nature abhors a vacuum, but not as much as a cat does” could be modified to:
- God abhors a vacuum, but not as much as a kitten does.
- Nature hates emptiness, but not as much as a kitty does.
- The Universe hates a vacuum, but not as much as a cat does.
The Rewriter feature lets users substitute parts of the post body using two different rule types. The first rule type allows users to replace post content portions with alternatives. This rule type affects the entire post body, including HTML code and URLs, and is case-sensitive.
The second type of rule applies only to text and not to HTML code or URLs. This rule type is case-insensitive and guarantees that the 1st word (“search”) will be replaced by one of the replacements (note the leading |
symbol there):
|search|replace1|replace2...
If you want to replace some portion of the post body (only text is affected, the HTML code and URLs are preserved) with another one, simply add the following line into your replacement table (note the leading >
symbol there):
>search|replace1|replace2...
This will replace all occurrences of “search” with one of the given “replace” values. For example:
>i like rock|i like jazz|i like hip hop >car|vehicle
Fine-Tuning Content with Custom PHP Code Snippets
Unlike other plugins that provide a dedicated field for entering regular expressions to remove specific parts of HTML code, CyberSEO Pro offers the flexibility to process syndicated content using custom PHP code snippets. If you are familiar with writing regular expressions, you can easily modify the $post['post_content']
variable by adding your custom PHP code snippet in the Custom PHP code box on the “Expert” tab of the feed settings. For example, you can use the following code to remove/replace content based on a regular expression:
$post['post_content'] = preg_replace('/myRegEx/', 'my replacement', $post['post_content']);
Here’s an example of how to remove all instances of a specific HTML tag, let’s say the image tag:
$post['post_content'] = preg_replace('/<img[^>]+\>/i', '', $post['post_content']);
Or, if you want to replace a certain string, “abc”, with another string, “xyz”, you could do:
$post['post_content'] = str_replace('abc', 'xyz', $post['post_content']);
In conclusion, the CyberSEO Pro plugin’s range of capabilities, from removing HTML tags and blocks, to synonymizing and rewriting, to even custom PHP code, makes it a versatile tool for managing content syndication on WordPress. By offering control at different levels of granularity, it allows users to better tailor imported content to their site’s needs and audience preferences. It truly redefines the content modification game and sets new standards in content syndication for WordPress.