Skip to content

Instantly share code, notes, and snippets.

@moxdev
moxdev / social-media.php
Last active March 6, 2019 14:58
ACF Social Media List #wp #acf
<?php
// Add this to functions.php acf options page
acf_add_options_sub_page(
array(
'page_title' => 'Social Media Channels',
'menu_title' => 'Social Media',
'menu_slug' => 'social-media-channels',
'post_id' => 'social-media-channels',
@moxdev
moxdev / diamond-square.css
Created January 30, 2019 21:54
Diamond Square Pure CSS
// Diamond Square
// https://css-tricks.com/the-shapes-of-css/
#diamond {
width: 0;
height: 0;
border: 50px solid transparent;
border-bottom-color: red;
position: relative;
top: -50px;
@moxdev
moxdev / page_titles.php
Created December 13, 2018 21:25
Allowed tags for H1 page title in Wordpress
<?php function slug_page_titles() {
if(function_exists('get_field')) {
if($on_page_title) { ?>
<header class="entry-header">
<h1 class="entry-title">
<?php echo wp_kses(
$on_page_title,
array(
'span' => array(),
@moxdev
moxdev / wp_kses_post.php
Created December 13, 2018 21:07
For echoing out WordPress wysiwig content.
echo wp_kses_post($variable);
@moxdev
moxdev / mm4-server-gh-integration.md
Created December 12, 2018 19:18
MM4 Server GH Integration

MM4 Server GitHub Integration

WordPress Installation

  1. Install WordPress
  2. In the /wp-content/themes directory, create a folder that matches your theme's text-domain (make sure permissions are set to 755)

Add SSH Key to Server

  1. From your terminal, SSH into the server: ssh -p port user@IP
@moxdev
moxdev / capitalize.js
Created July 5, 2018 14:53
Capitalize first letter of every word in a string in Javascript
capitalizeString = str => {
str = str.toString();
str = str.split(" ");
for (var i = 0, x = str.length; i < x; i++) {
str[i] = str[i][0].toUpperCase() + str[i].substr(1);
}
return str.join(" ");
};
@moxdev
moxdev / social-media-sprite.php
Created May 9, 2018 20:16
Social media svg sprite for use with WordPress and advanced custom fields plugin options page
<?php if( function_exists( 'acf_add_options_page' ) ) :
$fb = get_field( 'facebook_url', 'social' );
$pin = get_field( 'pinterest_url', 'social' );
$tw = get_field( 'twitter_url', 'social' );
$inst = get_field( 'instagram_url', 'social' );
$yt = get_field( 'youtube_url', 'social' );
$goo = get_field( 'google_plus_url', 'social' );
$link = get_field( 'linkedin_url', 'social' );
if( $fb || $pin || $tw || $insta || $yt || $goo || $link ) : ?>
@moxdev
moxdev / four-quadrant-image.css
Created May 4, 2018 19:01
Four images in equal four square boxes
.parent {
position: relative;
}
.wrapper {
display: block;
width: 50%;
position: absolute;
overflow: hidden;
}
@moxdev
moxdev / stop-transform-scale.css
Created April 5, 2018 15:22
Stop Transform of other element when using transform scale on a different element
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0) scale(1.0, 1.0);
transform: translateZ(0);
@moxdev
moxdev / wp_custom_allowed_tags.php
Created March 7, 2018 17:25
Add Custom Allowed Tags to WordPress Function File
if(!function_exists('custom_add_allowed_tags')) {
function custom_add_allowed_tags($tags) {
// iframe
$tags['iframe'] = array(
'src' => array(),
'height' => array(),
'width' => array(),
'frameborder' => array(),
'allowfullscreen' => array(),