Skip to content

Instantly share code, notes, and snippets.

View jonbrockett's full-sized avatar

Jon Brockett jonbrockett

View GitHub Profile
@jonbrockett
jonbrockett / Readme.md
Created January 17, 2019 14:27
WP - Adjust Media Library Thumbnail Sizes

You will generally want to use this when adjusting the medium and large size in the WP settings. Otherwise a much larger image will be used, bogging down the media library load.

Also, if you unset the medium file size, the full image size will be used. All the more important to use it for that.

To use in the FoundationPress theme, add before you register the new image sizes for use in the add media modal in wp-admin.

Or more generically, add to the functions.php file.

@jonbrockett
jonbrockett / functions.php
Created January 17, 2019 14:28
String to Slug
/** Convert string to slug */
require_once( 'library/string-to-slug.php' );
@jonbrockett
jonbrockett / format-phone.php
Created January 17, 2019 14:31
Format Phone Number (Custom Function)
<?php
/**
* Format Phone Number
*
* This function takes a 10 digit phone number and formats it
*/
function format_phone($s) {
$rx = "/
(1)?\D* # optional country code
@jonbrockett
jonbrockett / _buttons.scss
Created January 17, 2019 14:31
White Button (Foundation SCSS Class)
// White Button
.button.white {
background-color: $white;
color: $black;
border-color: $black;
&:hover {
background-color: scale-color($white, $lightness: -15%);
border-color: scale-color($black, $lightness: 15%);
color: scale-color($black, $lightness: 15%);
@jonbrockett
jonbrockett / functions.php
Created January 17, 2019 14:35
Get Top Parent Page (Custom WP Function)
/** Current Page's Parent */
require_once( 'library/get_top_parent.php' );
@jonbrockett
jonbrockett / functions.php
Created January 17, 2019 14:36
Get Posts (Blog) Page Title (Custom WP Function)
/** The Posts (Blog) Page Title */
require_once( 'library/get-posts-page-title.php' );
// Hero Video
.hero-video {
left: 50%; // To center video
transform: translate(-50%, 0); // To center video
min-width: 100%; // To stretch to the container
min-height: 100%; // To stretch to the container
position: absolute;
z-index: -1; // To drop behind content
}
@jonbrockett
jonbrockett / acf-options.php
Last active June 10, 2021 13:53
ACF Option Pages
<?php
/**
* ACF Option Pages
*/
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Site Settings',
'menu_title' => 'Site Settings',
@jonbrockett
jonbrockett / acf-googlemaps-api.php
Last active June 10, 2021 13:53
ACF Google Map API
<?php
/**
* ACF Google Map API Key
*/
function my_acf_init() {
acf_update_setting('google_api_key', '');
}
@jonbrockett
jonbrockett / functions.php
Last active June 10, 2021 13:42
Remove User Role Editor Plugin's 'Other Roles' Field
<?php
/** Remove User Role Editor's other roles field */
add_filter( 'ure_show_additional_capabilities_section', '__return_false' );