內容簡介
此外掛允許使用者透過 WordPress 評論系統表達情感(如 getsatisfaction.com,例如開心、中立、憤怒等)。使用者還可以將其評論與預定義的「主題」相關聯。整體情感和評論主題可以在管理系統中以使用者定義的日期範圍內顯示為圓餅圖。此外,評論(連同其情感和主題,如果有指定)可作為 CSV 匯出以進行離線分析。
請注意,為了完全整合此外掛,您需要修改您的佈景主題。這是為了讓佈景主題開發人員掌握所生成的標記的完全控制權。以下 迴圈-靈感的樣板標記用於呈現定義的情感和主題:
smtr_has_sentiments - 確定是否有要顯示的情感
smtr_the_sentiment - 初始化要顯示的當前情感
smtr_the_sentiment_name - 輸出當前情感的名稱(“開心”,“中立”,“憤怒”等),首先逃避任何 HTML
smtr_the_sentiment_value - 輸出當前情感值(“開心”,“中立”,“憤怒”等),首先逃避任何 HTML
smtr_has_topics - 確定是否有要顯示的主題
smtr_the_topic - 初始化要顯示的當前主題
smtr_the_topic_name - 輸出當前主題的名稱(“幫助”,“想法”,“建議”等),首先逃避任何 HTML
smtr_the_topic_value - 輸出當前主題值(“help”,“ideas”,“suggestions”等),首先逃避任何 HTML
smtr_is_topic_selected - 如果應選擇當前主題,則返回 TRUE(用於渲染具有多個主題選項的選擇表單元素)
這些樣板標記的建議佈局如下:
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <ul> <?php if ( function_exists('smtr_has_topics') ) : // 確保已安裝「Sentimeter」外掛 ?> <li> <?php if ( smtr_has_topics() ) : ?> <label for="smtr_topic">這是關於</label> <select id="smtr_topic" name="smtr_topic"> <?php while ( smtr_has_topics() ) : smtr_the_topic(); ?> <option value="<?php smtr_the_topic_value() ?>"<?php echo smtr_is_topic_selected() ? ' selected="selected"' : ''; ?>"><?php smtr_the_topic_name() ?></option> <?php endwhile; ?> </select> <?php endif; ?> </li> <li> <?php if ( smtr_has_sentiments() ) : ?> <fieldset class="radio-group"> <legend>我的感覺是</legend> <ul class="formatRadio"> <?php $i = 0; while ( smtr_has_sentiments() ) : smtr_the_sentiment(); ?> <li> <label for="smtr_sentiment_<?php smtr_the_sentiment_value() ?>"><?php smtr_the_sentiment_name() ?></label> <input type="radio" id="smtr_sentiment_<?php smtr_the_sentiment_value() ?>" name="smtr_sentiment" value="<?php smtr_the_sentiment_value() ?>"/> </li> <?php $i++; endwhile; ?> </ul> </
開發者團隊
原文外掛簡介
This plugin allows users to express sentiments (a la getsatisfaction.com, e.g. happy, neutral, outraged etc.) through the WordPress commenting system. Users can also associate their comment with a pre-defined ‘topic’. Overall sentiment, and comment topics, can be viewed as pie charts in the admin system, within a user-defined date range. Additionally, comments (along with their sentiment, and topic, if specified) can be exported as a CSV for further offline analysis.
Note that, in order to fully incorporate this plugin, you will need to modify your theme. This is so that theme developers have full control over the markup that is generated. The following Loop-inspired template tags are provided in order to render the defined sentiments and topics:
smtr_has_sentiments – determines whether their are any sentiments to display
smtr_the_sentiment – initializes the current sentiment for display
smtr_the_sentiment_name – echoes the current sentiment name (“Happy”, “Neutral”, “Outraged” etc.), first escaping any HTML
smtr_the_sentiment_value – echoes the current sentiment value (“happy”, “neutral”, “outraged” etc.), first escaping any HTML
smtr_has_topics – determines whether their are any topics to display
smtr_the_topic – initializes the current topic for display
smtr_the_topic_name – echoes the current topic name (“Help”, “Ideas”, “Suggestions” etc.), first escaping any HTML
smtr_the_topic_value – echoes the current topic value (“help”, “ideas”, “suggestions” etc.), first escaping any HTML
smtr_is_topic_selected – returns TRUE if the current topic should be selected (intended for use when rendering a select formm element with multiple topic options)
One suggested arrangement of these template tags is:
