Trackping Separator 中文教學

(注意:由於我太懶惰的緣故,這個中文說明頁某些步驟並未隨插件版本更新。請盡量參考英文版本,或與我聯絡,謝謝!)

之前在這裏介紹過 Trackping Separator 這套自製 Plugin,收到不少回應,在此小弟先感謝各位。當時過懶,沒有為此配件撰寫中文說明,實辜負了大家的一番心意;另為方便各看見小弟劣質英文望而卻步者提供途徑安裝及設定,現特以不合格水平的母語寫說明,希望大家合用。

第一步:從這裏下載 trackpings.phps 並改名為 trackpings.php,上載至 WP 的 plugin 目錄 (wp-content/plugins)。

第二步:從控制版面啟動該外掛。

第三步:更改若干佈景主題的模版 (Template),現列如下:

  • archive.php, index.php, search.php:
    在出現留言連結及數目連結的旁邊加進

    <a href="<?php the_permalink() ?>#trackback" title="引用" class="trackbacklink">引用/通告 (<?php trackpings('count'); ?>)</a>
    

    其中 “引用/通告”及 “引用” 可改成你想顯示的文字。

  • comments.php:
    到適當的位置(通常是 <!- – You can start editing here – -> 以下),加進:

    <?php if ($trackbacks = trackpings()) : ?>
    <?php trackpings('count'); ?><a name="trackback" id="trackback">Trackback/Pingbacks:<br /><br />
    <?php foreach ($trackbacks as $trackback) : ?>
    <p><a href="<?php echo $trackback->comment_author_url; ?>"> <?php echo $trackback->comment_author; ?> </a><br />
    <?php echo $trackback->comment_content; ?></p>
    <?php endforeach; ?>
    <?php endif; ?>
    

    其中 “Trackback/Pingbacks” 是標題,可以改動。而Ping/Track 的格式如果你明白的話便自己試試看,小弟不在這裏多提,因為基本上跟原來 comment 格式沒兩樣。結果是會在那裏列出所有的 trackback/pingback。

    <?php foreach ($comments as $comment) : ?>

    在那句下面加一行

    <?php if (get_comment_type() == 'comment') : ?>

    在<?php foreach ($comments as $comment) : ?>以下,另找

    <?php endforeach; ?>
    

    在那句上面加上

    <?php endif; ?>
    

    這樣是為了 trackback/pingback 不會在回應內顯示出來。據小踢姊回應說她因為安裝了對應回應的 plugin 所以不能執行這步,找天我也會在其他地方試試看有沒有解決辦法。

對了,在這幾天內應會推出 1.0.2,給用家更簡便的方法執行第三步,另外也會提供方法可讓 pingback 和 trackback 分開。

13 thoughts on “Trackping Separator 中文教學

  1. This is a very cool and long awaited plugin. Unfortunately, you probably have the answers I need in the above text, but they question marks not text. Could you please be very specific about where to put the tags in the comment.php file in the English version, and could you please explain how to make the Comments come first and the Trackbacks and Pings to come second (end of the list).

    Thank you and be sure and post a note about this on the WordPress Forums in the Plugins. Many have been waiting for this.

  2. Two more requests.

    How do I change the >> arrows in the trackbacks.

    And the trackbacks are still listed in the comments, but it works. I don’t know if I have put this in the wrong place, or have left code in that should have been removed because there is no clear instructions on this.

    Thanks.

  3. Dear Lorelle,

    First of all many thanks for supporting my plugin by letting me know your difficulties. I think I will rewrite the instructions on the page ASAP. And, for the >>.. Do u mean “»”? If so, the corresponding entity code for that symbol in HTML is “&raquo;” (without the quotes). Hope that helps.

  4. 你好,WordPress 就是這個地方讓我感到很不習慣,找了好久本來想放棄了自己試著寫寫看,沒想到你已經做出來了~~但我啟用它之後,出現了如下錯誤:

    Parse error: parse error, unexpected ‘}’ in /home/josesun/public_html/blog/wp-content/plugins/trackpings.php on line 13

    請問是什麼問題呢?

  5. 我又來了,雖然成功使外掛運作,但是我還是一直試都試不出來,後來我終於發現是你上面的 code 引號的問題…orz

    你在英文版已經修正了這個問題,但是中文版卻沒有…所以難怪我一直失敗…^^”

  6. hey.. it’s so good. but i have some problems which i ‘d like to solve.
    i don’t know well about php function.. so i wanna your help.

    /*
    i use this function ↓
    —————————————————*/
    <?php if ($comments) : ?>

    [the contents those are displayed when the comment exists.]

    <?php elseif : >
    .
    .
    .
    <?php endif; >
    /*—————————————————*/

    if some trackbacks or pings exist but any comments are not left,
    i want to remove the following source.

    /*—-the very thing i want to remove ——*/

    <h3 id=”comments”></h3>

    <ol class=”commentlist”>

    /* —- empty [due to nothing leaves]—- */

    </ol>
    /*—————————————-*/

    how can i fix it?
    you can see the example↓
    http://nonull.com/149
    view 84 line of code.

    and second problem..i’m using this code to skip to view comments quickly. but.. i don’t know how to do when the trackbacks exist.
    i’d like to separate the skip link each type of comments. would you help me?
    /*—————————————-*/
    <?php
    global $id;
    if (get_comments_number($id) > 0){
    ?>
    <a href=”#comments”>Skip to comments</a></p>
    <?php
    }
    ?>

    /*—————————————-*/
    sorry :) but now.. 3rd problem..

    i’d like to make a permalink id for trackbacks.
    such as following..
    #comment-<?php comment_ID() ?>

    thank you for reading this..

  7. 1. trackpings() will return the count of number of track/pingbacks with given specific parameters (Well, not documented), and u may try encapsulate the code block you do not want to be appeared by using

    <?php if (!trackpings('count') && !$comments) : ?>
    /* Code u want to appear when there are no trackpings and no comments */
    <?php endif; ?>

    Sorry I couldn’t get what you mean by “any comments are not left”… Could you be more specific? Thanks a lot. (PS : I could not view your php source directly from the web page, u have to give me the source code through other means (like e-mail)

    2. This could be done easily by adding the link to the code

    <?php if (trackpings('count')): ?>
    <a href="#trackback">Skip to trackbacks</a>
    <?php endif; ?>

    3. This is what I haven’t done in the cooment loop on the above tutorial. Could u see the foreach() trackping loop in comments.php? If yes, great.
    First u have to add a <li> block for each trackback entry (I assume u know a bit of HTML so u should get what I mean), and add id attribute to each of li block (id=”<?php echo the_ID(); ?>) (I’m not sure the_ID() function works in trackping loops. If it doesn’t you should try exploring $trackping and see what attributes are available (maybe $trackping->id).

    Hope I could answer your questions. E-mails to mk.is.here@gmail.com are welcomed.

Leave a Reply

Your email address will not be published. Required fields are marked *