2012-08-17 24 views
1

我試圖在tinyMCE中單擊「鏈接」按鈕時創建的所有鏈接自動添加類。我發現這個片段在tinyMCE的文檔:將類添加到由tinyMCE在Wordpress中創建的所有鏈接

// Adds a class to all paragraphs in the active editor tinyMCE.activeEditor.dom.addClass(tinyMCE.activeEditor.dom.select('p'), 'myclass'); I think this will be what I need if I change it to apply to anchors.

問題1:想想這是否行得通呢?知道更好的方法來做到這一點?

問題2:如何以及在哪裏添加此片段到我的主題?我正在使用的主題在函數目錄中有一個tinyMCE文件夾。

謝謝!

回答

1

所以我最終做了一個jQuery修復,而不是通過tinyMCE。代碼如下:

jQuery(document).ready(function(){ 
    $("#content a").addClass("link_color"); 
}); 
相關問題