Strict Standards: Declaration of action_plugin_importoldchangelog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/mk_is_here/public/wiki/lib/plugins/importoldchangelog/action.php on line 8

Strict Standards: Declaration of action_plugin_importoldindex::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/mk_is_here/public/wiki/lib/plugins/importoldindex/action.php on line 57

Deprecated: Assigning the return value of new by reference is deprecated in /home/mk_is_here/public/wiki/inc/parserutils.php on line 208

Deprecated: Assigning the return value of new by reference is deprecated in /home/mk_is_here/public/wiki/inc/parserutils.php on line 211

Deprecated: Assigning the return value of new by reference is deprecated in /home/mk_is_here/public/wiki/inc/parserutils.php on line 421

Deprecated: Assigning the return value of new by reference is deprecated in /home/mk_is_here/public/wiki/inc/parserutils.php on line 594

Strict Standards: Declaration of cache_instructions::retrieveCache() should be compatible with cache::retrieveCache($clean = true) in /home/mk_is_here/public/wiki/inc/cache.php on line 291

Deprecated: Function split() is deprecated in /home/mk_is_here/public/wiki/inc/auth.php on line 154

Warning: Cannot modify header information - headers already sent by (output started at /home/mk_is_here/public/wiki/lib/plugins/importoldchangelog/action.php:8) in /home/mk_is_here/public/wiki/inc/auth.php on line 245

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mk_is_here/public/wiki/inc/auth.php on line 475

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mk_is_here/public/wiki/inc/auth.php on line 472

Strict Standards: Only variables should be passed by reference in /home/mk_is_here/public/wiki/doku.php on line 71

Warning: Cannot modify header information - headers already sent by (output started at /home/mk_is_here/public/wiki/lib/plugins/importoldchangelog/action.php:8) in /home/mk_is_here/public/wiki/inc/actions.php on line 141
trackping_separator [mk's incubator]
 

Trackping Separator

Trackping Separator, by its name, is a WordPress Plugin that could separate trackbacks/pingbacks from user comments. Useful functions to list trackbacks are provided, but it requires heavy modification on the theme.

As this is my first plugin, there may exists bugs and may be harmful to your WP. So if you have encountered any problems please contact me ASAP by sending mk [dot] is [dot] here [at] gmail [dot] com or leave me a comment on my blog's TSP page. Thanks and enjoy!

(And sorry, it's nothing related to Traveling Salesperson)

News

Trackping Separator 2.0 is out! No more tedious modifications to the theme! Update is recommended.

Download

Installation/Template setup

After activated your plugin, edit your template as follows:

archive.php, index.php, search.php

  1. (Optional) Add the following code next to the comments_popup_link (remember it's outside from the <?php ?> tags):
<a href="<?php the_permalink() ?>#trackback" title="Trackback" class="trackbacklink">
<?php echo trackpings('count'); ?> Trackback/Pingback</a>

The output would be something similar to the one down below. This tag is quite similar to comments_popup_link(). The first 4 parameters are the same, you could look at the description here. The difference is that this has an extra one, which decides whether number of total trackbacks and pingbacks (default), only trackbacks, or only pingpacks are shown.

comments.php

Showing trackback/pingbacks

The old loop is gone, and the tag to replace it is:

<?php listtrackpings(); ?>

There are 2 parameters for this tag: The first is the type of links the tag would show. It could be either 'trackback' or 'pingback'. Leaving it empty would return both. So

<?php listtrackpings('trackback'); ?>

would show a list of trackbacks, and

<?php listtrackpings('pingback'); ?>

would show a list of pingbacks.

The second parameter is a little bit more complex. The pattern parameter is used to define how links are shown. In fact it is some HTML with defined variables. Let's take a look with the default value:

<li id="trackback-%id"><a href="%url">%origin</a><br />%content</li>

You should notice there are some percentage sign, right? Those are the tags that are going to be replaced with loop variables. I'll explain them one by one:

  • %id - The ID of the trackback/pinbback.
  • %url - The URL of the trackback/pingback.
  • %origin - The name of the blog/article that trackback/pingbacks you.
  • %content - The excerpt of that article.
  • %date - The date of the trackback/pingback

For common folks, this piece of code should works for you:

 <h2>Trackbacks/Pingbacks</h2>
 <ul><?php listtrackpings(); ?></ul>

NEW There's a third parameter that user could specify the format of the date string. For reference, please visit WordPress Codex.

Oh, and by the way, if you wish to show the number of trackback/pingback of that post, use the following tag:

<?php echo trackpings('count'); ?>

And the final one would look like this:

<h2><?php echo trackpings('count'); ?> Trackbacks/Pingbacks</h2>
<ul><?php listtrackpings(); ?></ul>

Expecting more steps? Sorry to disappoint you. Maybe move to your page and have a check to see if things works, alright?

FAQ

Q:How can I display the date for each trackback/pingback?

A:Use the variable %date in listtrackback() template function. There's an extra parameter for the function to specify the date format. For example, if you want to display the date in the trackping loop, the function call should be:

 <pre><?php listtrackpings('', '<li id="trackback-%id"><a href="%url">%origin</a>(%date)<br />%content</li>'); ?></pre>

Version History

Version 2.0

  • Feature: Add hooks to automatically filter out trackback/pingback from the comment lists. Comment numbers are also reflected.

Version 1.1.1

  • Bugfix/Feature: (Should be) WordPress 2.1 compatible, with reference to guidelines on WordPress Blog
  • Feature: Added date variable to listtrackpings()
  • Bugfix: comments_only_popup_link() and comments_only_number() updated

Version 1.1

  • Bugfix: Fixed/Updated the links
  • Feature: listrackpings() redesigned

Version 1.0.6a

  • Bugfix: listtrackpings() function now generates XHTML 1.1 compatible code

Version 1.0.6

(Don’t ever ask me where are 1.0.3 to 1.0.5! They are long gone! :P )

  • Feature: Finally a link to the trackback section!
  • Bugfix: I finally dare to test with the listtrackpings() function, and got some bugs… Luckily it seems nobody uses it

Version 1.0.2

  • Feature: Could show either trackbacks or pingbacks separately, or both
  • Feature: listtrackpings() could help template dummies showing trackbacks/pingbacks in the article page

Version 1.0.1

  • Added: comments_only_popup_link()

Version 1.0.0

  • Initial release. For internal test use.

PHP

 
trackping_separator.txt · Last modified: 2008/07/19 11:05 by mk
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki

Strict Standards: Only variables should be passed by reference in /home/mk_is_here/public/wiki/doku.php on line 79