Skip to content

Instantly share code, notes, and snippets.

View zachakbar's full-sized avatar
👻
...

{...} zachakbar

👻
...
View GitHub Profile
<!-- Section Layout -->
default : <span class="flip" title="Text Left / Image Right"><svg width="48" height="48" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-hidden="true" focusable="false"><path d="M13 17h8v-2h-8v2zM3 19h8V5H3v14zM13 9h8V7h-8v2zm0 4h8v-2h-8v2z"></path></svg></span>
alt : <span title="Image Left / Text Right"><svg width="48" height="48" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-hidden="true" focusable="false"><path d="M13 17h8v-2h-8v2zM3 19h8V5H3v14zM13 9h8V7h-8v2zm0 4h8v-2h-8v2z"></path></svg></span>
<!-- Column Split -->
split-equal : <span title="Two columns; equal split"><svg width="48" height="48" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H25V34H39ZM23 34H9V14H23V34Z"></path></svg></span>
spl
@zachakbar
zachakbar / menu-is-scrolling.js
Created April 23, 2020 17:03
add/remove classes to header on page scroll
menuIsScrolling: function() {
var $body = $('body'),
$header = $('header[role="banner"]'),
lastScrollTop = 0;
$(window).scroll(function(event){
var st = $(this).scrollTop();
if( st > 0 ) {
$header.addClass( 'is-scrolling' );
}
@zachakbar
zachakbar / _grid-columns.scss
Last active March 26, 2020 16:49
Grid columns with centered children.
@import "breakpoint";
// Breakpoints
$sm: 375px;
$md: 600px;
$md-lg: 768px;
$lg: 900px;
$lg-xl: 1032px;
$xl: 1170px;
$xxl: 1500px;
@zachakbar
zachakbar / sanitize-acf-fields.php
Last active April 7, 2023 19:04
Helper functions to sanitize data output by the get_field() & get_sub_field() functions.
<?php
/**
* @link https://snippets.khromov.se/sanitizing-and-securing-advanced-custom-fields-output/
* @link https://codex.wordpress.org/Validating_Sanitizing_and_Escaping_User_Data
*/
/**
* Helper function to sanitize data output by the get_field() function also normalize values.
*
* @param $field_key
@zachakbar
zachakbar / multiple-slick-sliders.js
Created January 17, 2019 18:19
Function to have multiple sliders on same page.
// Needs some tweaking per project.
function initSlickSlider(clsSlider,smSlides,mdSlides,lgSlides){
// init Slick slider
$(clsSlider).each(function (idx, item) {
var s = smSlides;
var m = mdSlides;
var l = lgSlides;
var carouselId = "carousel" + idx;
this.id = carouselId;
@zachakbar
zachakbar / type-style-checker.html
Last active January 15, 2019 18:33
Sample text to check type styles.
<section class="type-style-checker">
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
<p>A paragraph (from the Greek paragraphos, "to write beside" or "written beside") is a self-contained unit of a discourse in writing dealing with a particular point or idea. A paragraph consists of one or more sentences. Though not required by the syntax of any language, paragraphs are usually an expected part of formal writing, used to organize longer prose.</p>
<p><a href="#">Sample Text Link</a></p>
</section>
@zachakbar
zachakbar / README.md
Last active October 10, 2018 23:21
Add columns for checkboxes and radio buttons

How to use

  1. Upload the CSS.
  2. Add the following function to functions.php.
function admin_style() {
	wp_enqueue_style('admin_style', get_stylesheet_directory_uri().'PATH/TO/acf-checkbox-radio-columns.css'); 
}
add_action('admin_init', 'admin_style');
<?php echo '<pre>';print_r(get_intermediate_image_sizes());echo '</pre>'; ?>
// init empy git repo
git init
// connect repo to project
git remote add origin PROJECT_URL
// checkout branch
git fetch && git checkout BRANCH_NAME
// check working status
@zachakbar
zachakbar / menu-item-description.php
Created March 6, 2018 21:44
Add descriptions for menu items
/************************************************************************/
/* ADD DESCRIPTION TO MENU
/************************************************************************/
// Add description to navigation
function prefix_nav_description( $item_output, $item, $depth, $args ) {
if ( !empty( $item->description ) ) {
$item_output = str_replace( $args->link_after . '</a>', '<span class="menu-item-description">' . $item->description . '</span>' . $args->link_after . '</a>', $item_output );
}
return $item_output;