open
07.07.2022.

Codeblock with copy button wordpress plugin

Last update: 17.09.2022.

This wordpress plugin adds a button called codeblock to the classic editor to insert code. The wordpress plugin also creates a copy button.

New version available

Use the classic HTML editor or the codeblock shortcode

Update version 1.1:
protection against overflowing text
respositive copy button

Demo:

<?php $args = array(
‘post_type’ => ‘attachment’,
‘post_mime_type’ => ‘
application/pdf,
application/rtf,
application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,
application/vnd.ms-powerpoint,
application/zip,
application/vnd.oasis.opendocument.text,
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
application/vnd.ms-excel
‘,
‘numberposts’ => -1,
‘post_status’ => null,
‘post_parent’ => get_the_ID()
);

$attachments = get_posts( $args );
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
echo ‘<li>’;
the_attachment_link( $attachment->ID, true );
echo ‘</li>’;
}
} ?>

Copy to Clipboard

Related posts

Got a question? Is something not working? Write and I'll answer!

Leave a Reply

Your email address will not be published.

sixteen + 17 =