Итак, вот код, который я использовал, чтобы добавить копию в буфер обмена к фрагментам кода в этом блоге. Это следует из публикации опций jQuery copy clipboard 4, в которой есть несколько опций. Демо для этого на этой странице. Эта опция использует плагин Zero Clipboard и SWF-файл для выполнения копирования в буфер обмена по клику.
1: добавить плагин CodeColorer
Добавьте плагин CodeColorer WordPress (+ настройте параметры дисплея — цветовую схему и т. Д.)
2: добавить плагин ZeroClipboard
  Добавьте плагин ZeroClipboard на свою страницу. 
  ZeroClipboard.min.js 
3: Настройка плагина ZeroClipboard
С Code Colorer генерируются HTML-теги.
ZeroClipboard.setMoviePath("http://" + window.location.hostname + "/files/ZeroClipboard.swf");
a(".copy").mouseover(function () {
    var b = a(this).parents(".codecolorer-container:first").find(".codecolorer:first").text();
    clip = new ZeroClipboard.Client;
    clip.setHandCursor(!0);
    clip.setText(b);
    clip.glue(this);
    var c = a(this);
    clip.addEventListener("complete", function () {
        c.text("copied!").fadeIn("slow")
    })
});4: Добавить копию в буфер обмена
Прикрепите кнопку «Копировать в буфер обмена» ко всем фрагментам кода на странице.
 a(".codecolorer-container").each(function (b) {
    a(this).prepend('Plain Copy');
    a(this).attr("id",
        "d_clip_container_" + b)
});
a(".codecolorer-container").on("mouseenter", function () {
    a(this).find("a").addClass("showactive")
}).on("mouseleave", function () {
    a(this).find("a").removeClass("showactive")
});  «);
     а (это) .attr ( "ID",
         "d_clip_container_" + b)
 });
 a (". codecolorer-container"). on ("mouseenter", function () {
     а (это) .find ( "а"). addClass ( "showactive")
 }). on ("mouseleave", function () {
     а (это) .find ( "а"). removeClass ( "showactive")
 }); 
5: При желании добавить вид в простом (необработанном)
a(".codecolorer-container a.plain").live("click", function () { console.log("copy to plain.."); var b = a(this).parents(".codecolorer-container:first").find(".codecolorer:first").text(); this._Window = window.open("", "jQuery4u Code Snippet", "location=0,status=0,toolbar=0,dependent=1,resizable=1,menubar=0,screenX=100,screenY=100,width=600,height=400"); this._Window.document.write(""); this._Window.document.write(""); this._Window.document.write("" + b + "«); this._Window.document.write (» «); this._Window.document.write (»"); this._Window.document.write(""); this._Window.document.write("") }) ror.insertAfter(element); }});«);
this._Window.document.write (» «);
this._Window.document.write (» «)
})
ror.insertAfter (элемент);
}});
