Skip to content


How to Show the Trackback Link of a Post in WordPress

I’m just starting blogging and I’m not so familiar with tools. My friend Chris proposed me to use WordPress as a blogging tool. It was a good choice. I set it up quite fast and started to use it right away. I didn’t have to read tutorials. It is quite self evident how to use it. Chris also gave a link to some WordPress themes. I didn’t want to spend too much time for making my own style/theme so I selected Firebug from the list. It was an easy round again to set the theme up in WordPress. So far so good. The only thing that I was missing is the trackback link from the end of each posts. So I started to google around. Most of the hits explained how to refer to trackback links. Finally I have found a post at a blog where the blogger explained what I needed.

It says all that I need to do is to add the following to the end of the code that shows a post:

<a href=”<?php trackback_url(true); ?>”>Trackback This Post</a>

It mentions single.php as the possible source that I should modify. OK. I checked and found single.php in Firebug. I modified it, but nothing happened. I also found there is already the following code in single.php:

<?php } elseif (!(‘open’ == $post-> comment_status) && (‘open’ == $post->ping_status)) {
// Only Pings are Open ?>
Responses are currently closed, but you can <a href=”<?php trackback_url(); ?> ” rel=”trackback”>trackback</a> from your own site.

<?php } etc.

OK. It seems that it is not the single.php that actually shows my post. I quickly checked the firebug sources and found index.php in the same directory where single.php was. I tried to modify it and BINGO! It is the one. So I added the following:

<?php if (‘open’ == $post->ping_status)
{?>
You can <a href=”<?php trackback_url(); ?> ” rel=”trackback”>trackback</a> from your  site.<br/><br/>
<?php } ?>

As you can see it is similar to the code I have found in single.php. I just removed the comment status checking and modified the text a bit. It works fine.

Posted in Blogging tools, tips, tricks.

Tagged with , , , , , .