Skip to content

Instantly share code, notes, and snippets.

View stephensabatini's full-sized avatar
🏔️
“Even the smallest person can change the course of the future.” – Galadriel

Stephen Sabatini stephensabatini

🏔️
“Even the smallest person can change the course of the future.” – Galadriel
View GitHub Profile
@stephensabatini
stephensabatini / accessible_edit_post_link.php
Last active March 21, 2018 02:54
Accessible and Translation-Ready Edit Links in WordPress from functions.php.
<?php
function filter_edit_post_link( $link, $post_id, $text ) {
if ( $text === __( 'Edit This' ) ) {
return str_replace( $text, sprintf( __( 'Edit<span class="screen-reader-text"> "%s"</span>' ), get_the_title() ), $text );
}
}
add_filter( 'edit_post_link', 'filter_edit_post_link', 10, 3 );
?>
<?php
function quicktags($qtInit, $editor_id = 'content') {
$qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
return $qtInit;
}
add_filter('quicktags_settings', 'quicktags', 10, 2);
?>
<?php
// Add more buttons to the html editor
function add_quicktags() {
if (wp_script_is('quicktags')) {
?>
<script type="text/javascript">
QTags.addButton(
'example_input',
'input',
prompt
@stephensabatini
stephensabatini / .htaccess
Created July 17, 2017 18:22
Snippet of Security Tweaks for the .htaccess.
# Deny access to include files.
<Files ~ "\.inc$">
Order Allow,Deny
Deny from All
</Files>
# Deny access to hidden files.
RedirectMatch 403 /\..*$
# Deny access to folders.