Skip to content

Instantly share code, notes, and snippets.

View joshapgar's full-sized avatar

Josh Apgar joshapgar

View GitHub Profile
<section class="calendar-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="header-wrapper">
This is the header.
</div>
<div class="blocks-wrapper">
<div class="row block-row">
<div class="block block-1">
<?php
function activate_gutenberg_for_post_type( $is_enabled, $post_type ) {
if ( 'post-type-name-here' == $post_type ) {
return true;
} elseif('page' == $post_type) {
global $post;
$pageTemplate = get_post_meta($post->ID, '_wp_page_template', true);
if($pageTemplate == 'page-template-name-here.php') {
return true;
} else {
$('.section-7-products-number').each(function () {
$(this).prop('Counter',0).animate({
Counter: $(this).attr('data-stop')
}, {
duration: 2500,
easing: 'easeInOutQuart',
step: function (now) {
now = Number(Math.ceil(now)).toLocaleString('en');
$(this).text(now);
}
@joshapgar
joshapgar / example-custom-post-type.php
Last active March 14, 2019 01:37
Custom Post Type with all the options.
<?php
if ( ! function_exists('portfolio_post_type') ) :
// Add Portfolio Projects to WordPress
add_action( 'init', 'portfolio_post_type', 0 );
// Register Portfolio Projects Custom Post Type
function portfolio_post_type()
{
$labels = array(
@joshapgar
joshapgar / desktopmenutouch.js
Last active March 5, 2019 15:58
Function for detecting touch device and adding class to menu items when clicked with touch device.
function is_touch_device() {
var prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
var mq = function(query) {
return window.matchMedia(query).matches;
}
if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
return true;
}
@joshapgar
joshapgar / breadcrumbs.php
Created September 24, 2018 13:08
Wordpress Breadcrumbs
/***********************
* BREADCRUMBS
***********************/
function streamlineBreadcrumbs($post, $displayCurrent){
$count = 1;
$postAncestors = get_post_ancestors($post);
$sortedAncestorArray = array();
foreach ($postAncestors as $ancestor){
$sortedAncestorArray[] = $ancestor;
@joshapgar
joshapgar / style.css
Created September 14, 2018 13:13
Text with mix-blend-mode background
.bg {
background-image: url('https://images.unsplash.com/photo-1501706362039-c06b2d715385?auto=format&fit=crop&w=1070&q=60&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D');
background-repeat: no-repeat;
background-position: center center;
padding: 100px 50px;
}
.text {
position: relative;
}
@joshapgar
joshapgar / acf-search.php
Created September 13, 2018 14:32
ACF to Search Results
// Make the search to index custom
/**
* Extend WordPress search to include custom fields
* http://adambalee.com
*
* Join posts and postmeta tables
* http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_join
*/
function cf_search_join( $join ) {
global $wpdb;
@joshapgar
joshapgar / Bootstrap-4-Breakpoints.txt
Created July 18, 2018 14:47
New bootstrap 4 show hide utilities
Show/hide for breakpoint and down:
hidden-xs-down (hidden-xs) = d-none d-sm-block
hidden-sm-down (hidden-sm hidden-xs) = d-none d-md-block
hidden-md-down (hidden-md hidden-sm hidden-xs) = d-none d-lg-block
hidden-lg-down = d-none d-xl-block
hidden-xl-down (n/a 3.x) = d-none (same as hidden)
Show/hide for breakpoint and up:
hidden-xs-up = d-none (same as hidden)
@joshapgar
joshapgar / git-deployment.md
Created May 7, 2018 15:10 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.