Skip to content

Instantly share code, notes, and snippets.

View szbl's full-sized avatar

Sizeable, Inc. szbl

View GitHub Profile
@szbl
szbl / wp-alt-text.php
Last active January 4, 2019 17:21
Get WP Attachment Image Alternate Text (alt text attribute)
<?php
echo esc_attr( get_post_meta( $att_id, '_wp_attachment_image_alt', true ) );
@szbl
szbl / permissions.sh
Last active July 22, 2018 20:42
Liquid Web / Storm Permissions
# for directories
find . -type d -exec chmod 755 {} \;
# for files
find . -type f -exec chmod 644 {} \;
{
"legend": {
"title": "Primary Care (PCMH) Sites",
"labels": ["1-20 Sites", "21-60 Sites", "61-200 Sites", "201+ Sites"],
"ranges": [
{
"min": 1,
"max": 20,
"color": "#9ecae1"
},
@szbl
szbl / login-restart.sh
Created May 30, 2018 19:06
Restart CentOS login daemon after updates - SSH hangs
systemctl restart systemd-logind
// psuedo-code
{
"query" : "some event",
"results" :
"events" : [
{
"event_name": "Some Event Name 123",
"event_id" : 123
},
{
<?php
add_filter('next_posts_link_attributes', 'posts_link_attributes');
add_filter('previous_posts_link_attributes', 'posts_link_attributes');
function posts_link_attributes() {
return 'class="styled-button"';
}
<?php
/*
Plugin Name: Sizeable Whitelist Login
Author: Sizeable Interactive
Author URI: https://www.sizeableinteractive.com
Version: 0.1
Description: Server agnostic plugin to white list WordPress login screen to IP addresses using a self-authenticating secret URL.
**** NOTE ***
You must define the SZBL_SECRET_LOGIN_URL or set a login URL in the settings page for this plugin to take affect.
<?php
function subval_sort( $a, $b )
{
if ( $a['date'] == $b['date'] )
return 0;
return $a['date'] < $b['date'] ? -1 : 1
}
usort( $post_data, 'subval_sort' );
@szbl
szbl / acf-theme-settings
Created June 21, 2017 18:10
ACF Themes Settings Page
<?php
if ( function_exists( 'acf_add_options_page' ) )
{
$option_page = acf_add_options_page(array(
'page_title' => 'Theme General Settings',
'menu_title' => 'Theme Settings',
'menu_slug' => 'theme-general-settings',
'capability' => 'edit_posts',
'redirect' => false
<script type="text/javascript"> window._pt_lt = new Date().getTime(); window._pt_sp_2 = []; _pt_sp_2.push('setAccount,5fd92b3a'); var _protocol = (("https:" == document.location.protocol) ? " https://" : " http://"); (function() {var atag = document.createElement('script'); atag.type = 'text/javascript'; atag.async = true; atag.src = _protocol + 'jsv2.ptengine.com/pta.js'; var stag = document.createElement('script'); stag.type = 'text/javascript'; stag.async = true; stag.src = _protocol + 'jsv2.ptengine.com/pts.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(atag, s);s.parentNode.insertBefore(stag, s);})();</script>