How to Set Up Feed to Post's Append and Prepend to Content Options

There are times you may want to add your own custom content before and/or after the content that you are importing.

For example, you may wish to add a line of text crediting the original source, or add a video of your own before every post, say for commercial purposes.

The Feed Source Settings

Both these options can be used on a per-feed-source basis. So each feed source would have its own settings for what to append and/or prepend to the imported posts.

The  Prepend option adds your own text before the original post’s content.

The  Append option adds your text after the original post’s content.

wpra-feed-to-post-append-prepend-to-content-1

This content will be added to the post on the fly when the post is displayed, meaning you will not see this content when editing your imported posts. However, this also means that you can change this text at any time and the changes will immediately be visible on your site, as soon as you save the feed source.

You have a visual editor to enter content as if you were creating a normal WordPress post, and you also have access to the Text view.

[image]

NOTE: For those specific cases where you need to add content in the Text view, but cannot switch to the Visual view as it would break the content, we introduced a feature to Disable the Visual Editor, which will apply only to the Feed Sources post type.

Finally, you have the option to  Append/Prepend only to singular posts. This will show the appended/prepended text only when viewing a post by itself and not when viewing a series of posts.


Placeholders

The Append and Prepend options also allow you to use placeholders, which are special text phrases that the plugin will convert according to what the placeholder represents. 

Edit
Placeholder What will replace it
{{feed_name}} The name that you have given to the feed source.
{{feed_url}} The URL of the original site, or the URL of feed source if the feed did not specify the site’s URL.
{{post_title}} The title of the imported post.
{{post_url}} The URL of the imported post, on your site.
{{original_post_url}} The URL of the original post, on the original site.
{{post_author_name}} The name of the post author.
{{post_import_date}} The date on which the imported post was imported.
{{post_publish_date}} The date on which the original post was published on the original site.
{{post_author_url}} The URL of the post author, if available.
{{meta : xyz}} The custom meta field ‘xyz’ of the imported post. Change ‘xyz’ to the name of any meta field you want.
{{source_meta : xyz}} The custom meta field ‘xyz’ of this feed source. Change ‘xyz’ to the name of any meta field you want.



Placeholders & Shortcodes

If you are using the  URL shortcode to show links, such as:

[[url={{original_post_url}}] My Link [/url]]

...then we recommend that you enter this from the Editor’s  Text View to ensure that the placeholder works with the shortcode. This is currently required due to the way WordPress adds links. Rather than writing:

<a href=”http://{{original_post_url}}”>….

Please use:

<a href=”{{original_post_url}}”>…

Here’s a screencast to show the above:

Example

If you enter the following:

This post first appeared on {{feed_name}}. Read the <a href=”{{original_post_url}}”>original article</a>.

At runtime, this will be parsed and the following will be the output:

This post first appeared on WP Mayor. Read the  original article.

Note that we are using a sample feed name and original post URL in the example, it will be different in your individual case.


Placeholder Editor Integration

The placeholders also integrate seamlessly with the editor, making it easy to insert elements, such as links, using the placeholders.

In the example below, I am demonstrating this by using the  {{original_post_url}}placeholder in the editor’s link dialog.

wpra-feed-to-post-append-prepend-to-content-2


Placeholders for Post Meta (Custom Fields)

There are times when you may want to enter a custom field as a placeholder in your Append or Prepend to Content areas. Here’s a look at how this can be done. In these examples we’ll make use of both the {{meta : xyz}} and {{source_meta : xyz}} placeholders.

Both refer to the “post meta” or “custom fields” of a WordPress post. The former (meta) refers to the imported post and the latter (source_meta) refers to the Feed Source itself. You will be able to see the Custom Fields for the imported posts (by enabling their view from the ‘Screen Options’, if you haven’t) and get the values from there or use a plugin such as  Post Meta Inspector.

Here’s an example of a value we can use for {{meta : xyz}}:

And here’s the sample for {{source_meta : xyz}}:

Here’s how we can use it in the Append or Prepend to Content options:

And here is what the result would look like within the post itself:

Still need help? Contact Us Contact Us