2014-01-19 43 views
0

我有一個網站,天氣參數非常重要。他們顯示在每個頁面上,並且管理員應該每天輕鬆更新它們。在wordpress儀表板上編輯主題字符串變量

因此,如果在儀表板上有這四個字符串變量,然後編輯並保存它們會很好。

有沒有插件的方式來添加一些字符串儀表板,然後輸出他們的主題?或者我應該開始學習如何編寫我的第一個插件?

感謝您的幫助。

[編輯] 我們有一些插件,它可以這樣做,但現在的問題是:

如何顯示管理插件頁面上的儀表盤上的小工具?

+0

試試這個插件:http://wordpress.org/plugins/options-framework/或這個:https://github.com/syamilmj/Options-Framework – andreivictor

+0

我也發現:http:// wordpress .ORG /插件/只-WP-變量/ – lucaste

回答

1

因此該解決方案基於兩個插件和一些複製粘貼操作。

  1. 安裝:只要變量從http://wordpress.org/plugins/just-wp-variables/
  2. 插件就管理員>設置一些變量>只是變量
  3. 從yourdomain.com/
  4. http://wordpress.org/plugins/widget-builder/
  5. 安裝的Widget生成器製作新的小部件和複製粘貼的形式wp-admin/themes.php?page = jv_theme_vars
  6. 選擇「Available As Dashboard Widget」,保存並轉到儀表板。

你可以改變的輸入值的變量輸出,這應該是這樣的:

<form action="options.php" method="post"> 
    <input type="hidden" value="jv_theme_vars" name="option_page"/><input type="hidden" value="update" name="action"/><input type="hidden" value="ded28ad4c4" name="_wpnonce" id="_wpnonce"/><input type="hidden" value="/wp-admin/themes.php?page=jv_theme_vars" name="_wp_http_referer"/> 
    <table class="form-table"> 
     <tr valign="top"> 
      <th scope="row">Your Variable</th> 
      <td><input type="text" style="width: 15em" name="jv_values[your_variable]" value="[justvar code="your_variable"]" class="regular-text"/></td> 
     </tr> 
    </table> 
    <p class="submit"><input type="submit" value="Save" class="button button-primary" id="submit" name="submit"/></p>  
</form> 

好運。 :)