Simple:Press Documentation

Plugin: Blog Linking

The Simple:Press Blog linking plugin automatically creates new forum topics from your blog posts. It also creates a link in the blog post to the forum and a forum link back to the blog post.
The plugin has options to create forum posts from linked blog comments and allows for their display in the forum as well as displaying the topic posts in the comments section of the blog.

Plugin Requirements

This plugin requires Simple:Press version 5.5.8 and above.

Blog Linking Plugin Administrative Options

The following are some of the options available for Blog Linking. These are all found in the Simple:Press Administration page – Components  > Blog Linking

Post Linking

Post Linking allows you  to automatically create a new forum topic with the content of a blog post.

Auto-Create Option

With the Auto-Creation turned on the blog linking form that displays in the WordPress  new post/page panel will be automatically checked and, if left checked, will create a new topic in the default or the forum you select.

Default Forum

The forum selected will be used as the default target for auto-created linked topics.  A different forum can be selected at the blog Post creation time.

Post Types

Select the types of content you wish to place the blog linking form in when editing. The standardf types are ‘Post’ and ‘Page’ but others may be added via themnes or plugins using the Custom Post Type API.

Post Edit Updating

Leaving this option checked will ensure that should the post be edited and updated then change will be reflected in the forum topic. This works both ways. This option can be overridden on the blog link form.

Post linking type

As an option to Post Linking, you can decide to create a forum post using the entire blog post post content or an excerpt from post content or an excerpt of of the post using your except settings in  WordPress.

If you turn on “Excerpt from post content” enter the word count you wish the excerpt to be truncated to on the line shown for word count.

Show Topic Posts as Comments

By turning on this option, you will be able to display the posts/replies in the forum as comments on the linked blog post.

You can select to to not add to comments, display them mixed in standard comment block or display them in separate comment block

Hide Duplicates

If you are showing topic posts as comments and creating topic posts from comments without deleting the original then two copies of these will be displayed in the blog post comment list – the original blog comment AND the replicated topic post. In these circumstances you may want to hide the duplicate topic posts created automatically from blog comments. The Hide Duplicates option will do this.

Create Topic Posts from Comments

Before using these options live it is recommended they be tested on your site as other plugins that operate on post and comment creation can effect the results.

Create New Topic Posts from Blog Post Comments

Once enabled, a new topic post will automatically be created in the linked topic with the comment content. This will occur when the comment is approved or at the time the comment is made if the comment needs no approval.

Delete Original Comment Upon Topic Post Creation

If enabled, the original comment will be deleted at the time the topic post is created. Use this with care as once the comment is removed it can not be restored. This option is intended for those that wish the forum to completely replace their commenting system.
There is no harm in leaving the original comment records other than database storage.

Update Topic Post on Comment Edit or Delete

If enabled, this option will update topic posts when the original comment is edited.

Create blog post to topic link automatically

You can have Simple:Press create the forum topic link (on the blog post) automatically.
Turning on this option creates a link at the bottom of your blog post back to the forum post.

Link above post content

You can choose to have the blog post link displayed above post content

Show post/forum link on single pages only

Select this if you wish to only show the link in single page view.

Link Display Text

If you are using Post Linking, you can determine the link text that displays in the blog post. There is a default text already setup or you can change it as needed.

Various data items can be inserted by using the supplied placeholders. These are:

%ICON% – the forum skins blog link icon
%FORUMNAME% – the name of the forum containing the linked topic
%TOPICNAME% – the name of the topic itself
%POSTCOUNT% – the number of topic posts that have been made
%LINKSTART% – Starting position of the actual link. If not used the link will start at the beginning of the text
%LINKEND% – Ending position of the actual link. If not used the link will stop at the end of the text

Blog Linking Canonical URLs

If you are using blog linking and linking the complete content, its possible you may be considered to have duplicate content on the blog post page and the forum topic.
The blog linking canonical URL option allows you leave the canonical URLs as they are by default pointing to their respective URLS, to point the blog post canonical URL to the forum topic, or to point the forum topic canonical URL to the blog post.
The options are: Blog post and linked topic have their own canonical URL, Point blog post to linked topic or Point linked topic to blog post.

Template-Tags

There are template tags available for this plugin that allows you to further customize it’s usage or otherwise customize your website.

The template tags available are:

sp_TopicHeaderShowBlogLink() – Display the blog link on the topic view by creating a button and/or link in the forum topic to the blog post.

Usage

sp_TopicHeaderShowBlogLink($args=”, $label=”, $toolTip=”)

Arguments

  • tagId – A unique id to use for div or list. This would be text. The default is spTopicHeaderShowBlogLink.
  • tagClass – The class to be applied for styling. This would be text. The default is spButton.
  • icon – Filename of the icon to be shown. The default is sp_BlogLink.png.
  • iconClass – CSS class for the icon image. The default is spIcon.
  • echo is a true/false expression using 1 as true and 0 as false. The default is true (1).

NOTE: True must be expressed as a 1 and False as a zero

$label – Text shown on the button.
Type: (string) (optional)
Default: None

$toolTip – Text shown when button hovered over by cursor.
Type: (string) (optional)
Default: None

Usage

An example of using this tag with default settings and the text “Original Post” displayed on the button and “View the Blog Post” when hovered.

<?php sp_TopicHeaderShowBlogLink('tagClass=spButton','Original Post','View the Blog Post') ; ?>

Actions and Hooks Used in this Template Tag

  • apply_filters(‘sph_TopicHeaderShowBlogLink_args’, $a); – allows modification of the arguments to the template tag. $out contains the parsed arguments.
  • apply_filters(‘sph_TopicHeaderShowBlogLink’, $out, $a); allows modification of the display code just prior to being output/returned. $out will contain the html display code.

 


spBlogTopicLink() – Allows display of forum topic link for blog linked post outside of the post content

Usage

spBlogTopicLink($postid, $show_img=true)

$postid – id number of the blog post
Type: (number) (required)
Default: None

$show_img – display blog linked image icon as in True or False. True must be expressed as a 1 and False as a zero
Type: (string) (optional)
Default: None

Usage

An example of using this tag for blog post ID #100 and display image.

<?php spBlogTopicLink('100','1') ; ?>

Actions and Hooks Used in this Template Tag

None


spCommentsNumberTag() – Replaces the WP Template Tag: comments_number().   Supplies Count of topic posts and can optionally include the standard blog comments in the total

Usage

spCommentsNumberTag($no_comment=”0 Comments”, $one_comment=”1 Comment”, $many_comment=”% Comments”, $blogcomments=false, $postid=0)

parameters:
$no_comment: Used for zero comments – text
$one_comment: Used for one comment – text
$many_comment: Used for multiple comments – text
$blogcomments: Include Standard Blog Comments – (true or false) 1 being true and 0 (zero) false.
$postid: Option to specify postid, otherwise $wp_query is used –  integer

Usage
An example of using this tag for blog post ID #100 and display image.

<?php pCommentsNumberTag('0','Comments','Comment','Comments','1'); ?>

Actions and Hooks Used in this Template Tag

None


Actions and Hooks Used in Plugin

In function sp_save_blog_link() and sp_publish_blog_link() –  Called on  a Post Save to create the blog/forum Link.

  • apply_filters(‘sph_blog_linked_forum’, $forumid) – Allow the target forum ID to be changed.

In function sp_sync_blog_tags() –  Which creates topic tags based on blog post tags, if used.

  • apply_filters(‘get_the_tags’, wp_get_object_terms($postid, ‘post_tag’)) – Get tags for wp blog post
  • apply_filters(‘sph_add_tags_to_topic’, $terms, $postid) – Get tags for wp blog post

In function sp_do_create_blog_post() –  Which saves blog post from forum topic.

  • apply_filters(‘sph_blog_link_post_data’, $post, $postdata)

In function sp_transform_bloglink_label() – called to format the label to display on blog posts.

  • apply_filters(‘sph_blog_link_label’, $out, $postid) – Allow the blog post link itself to be changed.

In sp-linking-show-link.php Template Tag file, function  sp_TopicHeaderShowBlogLink() which creates a button which links to the blog post.

  • apply_filters(‘sph_TopicHeaderShowBlogLink_args’, $a) – allows modification of the arguments to the template tag. $a contains the parsed arguments.
  • apply_filters(‘sph_TopicHeaderShowBlogLink’, $out, $a) – allows modification of the display code just prior to being output/returned. $out will contain the html display code.

Please see Using Plugins on how to obtain and install the Blog Linking plugin.

Plugin and Template Tag Changelog

Version 5.6.0 and plugin version 1.2.13 – apply_filters(‘sph_blog_link_label’, $out, $postid) added to function sp_transform_bloglink_label().

More Topics In SimplePress: Plugins


Copyright © 2006-2019 Simple:Press. All Rights Reserved.