Scroll inner hash links

JS

// scroll
$('a[href*="#"]:not([href="#"])').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
		var target = $(this.hash);
		target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
		if (target.length) {
			$('html, body').animate({
				scrollTop: target.offset().top
			}, 800);
			return false;
		}
	}
});

Enable upload of exe files in WordPress

PHP

// Allow upload of exe file type
add_filter( 'upload_mimes', 'themeslug_mime_types' );
function themeslug_mime_types( $mime_types ) {
    $mime_types[ 'exe' ]  = 'application/x-msdownload';
    return $mime_types;
}
add_filter( 'wp_check_filetype_and_ext', 'themeslug_wp_check_filetype_and_ext', 10, 4 );
function themeslug_wp_check_filetype_and_ext( $types, $file, $filename, $mimes ){
	if(substr($filename, -4) == ".exe" && $types['ext'] == "" && $types['type'] == ""){
        $filetype = wp_check_filetype( $filename, $mimes );
		$types['ext'] = $filetype['ext'];
		$types['type'] = $filetype['type'];
	}
	return $types;
}

Custom post states

// custom post state
add_filter('display_post_states', 'theme_slug_custom_post_states');
function theme_slug_custom_post_states($states) {
    global $post;
    if( ('page' == get_post_type($post->ID) ) && get_page_template_slug( $post->ID ) ) {
		$templates = get_page_templates();
		if( empty( $templates ) ){
			return $states;
		}
		$template_slug = get_page_template_slug( $post->ID );
		foreach ( $templates as $key => $value ) {
			if ( $value == $template_slug ){
				$states[] = "<small>" . $key . " template</small>";
			}
		}
    }
    return $states;
}

Bootstrap 4 dropdown hover

CSS

.dropdown:hover>.dropdown-menu {
    display: block;
}

or

JavaScript

function toggleDropdown (e) {
  const _d = $(e.target).closest('.dropdown'),
    _m = $('.dropdown-menu', _d);
  setTimeout(function(){
    const shouldOpen = e.type !== 'click' && _d.is(':hover');
    _m.toggleClass('show', shouldOpen);
    _d.toggleClass('show', shouldOpen);
    $('[data-toggle="dropdown"]', _d).attr('aria-expanded', shouldOpen);
}, e.type === 'mouseleave' ? 150 : 0);
}

$('body')
  .on('mouseenter mouseleave','.dropdown',toggleDropdown)
  .on('click', '.dropdown-menu a', toggleDropdown);

Container fluid left right

SCSS

@mixin make-container-fluid-left-right($gutter: $grid-gutter-width) {
    width: 100%;
    padding-right: $gutter / 2;
    padding-left: $gutter / 2;
}
@mixin make-container-fluid-left($max-widths: $container-max-widths, $breakpoints: $grid-breakpoints) {
    @each $breakpoint, $container-max-width in $max-widths {
        @include media-breakpoint-up($breakpoint, $breakpoints) {
            margin-right: calc((100% - #{$container-max-width}) / 2);
            width: calc(100% - ((100% - #{$container-max-width}) / 2));
        }
    }
}
@mixin make-container-fluid-right($max-widths: $container-max-widths, $breakpoints: $grid-breakpoints) {
    @each $breakpoint, $container-max-width in $max-widths {
        @include media-breakpoint-up($breakpoint, $breakpoints) {
            margin-left: calc((100% - #{$container-max-width}) / 2);
            width: calc(100% - ((100% - #{$container-max-width}) / 2));
        }
    }
}
.container-fluid-left {
    @include make-container-fluid-left-right();
    @include make-container-fluid-left();
}
.container-fluid-right {
    @include make-container-fluid-left-right();
    @include make-container-fluid-right();
}

Using wp_nav_menu for creating submenu

functions.php

// filter menu to submenu
add_filter( 'wp_nav_menu_objects', 'submenu_limit', 10, 2 );
function submenu_limit( $items, $args ) {
	if ( empty( $args->page_parent ) ) {
		return $items;
	}
	$subitems = array();
	foreach ($items as $key => $item) {
		if($item->post_parent == $args->page_parent){
			$subitems[] = $item;
		}
	}
	foreach ($subitems as $key => $subitem) {
		submenu_get_children($items, $subitems, $subitem);
	}
	return $subitems;
}
function submenu_get_children($items, &$subitems, $subitem){
	foreach ($items as $key => $item) {
		if($subitem->ID == $item->menu_item_parent){
			$subitems[] = $item;
			submenu_get_children($items, $subitems, $item);
		}
	}
}

Usage in template

$parents = get_post_ancestors( $post->ID );
$parent_id = ($parents) ? $parents[count($parents)-1]: $post->ID;
$args = array(
    'post_parent' => $parent_id,
);
$children = get_children( $args );

// optional, check if page has children
if($children){
	wp_nav_menu([
		'menu'            => 'menu-1',
		'theme_location'  => 'menu-1',
		'container'       => '',
		'container_id'    => '',
		'container_class' => '',
		'menu_id'         => false,
		'menu_class'      => 'navbar-nav',
		'depth'           => 3,
		'page_parent'	  => $parent_id
	]);
}

Responsive column margin

SCSS

.col-item {
    margin-bottom: $grid-gutter-width;
}
.col-item-sm {
    margin-bottom: $grid-gutter-width;
    @include media-breakpoint-up(sm) {
        margin-bottom: 0;
    }
}
.col-item-md {
    margin-bottom: $grid-gutter-width;
    @include media-breakpoint-up(md) {
        margin-bottom: 0;
    }
}
.col-item-lg {
    margin-bottom: $grid-gutter-width;
    @include media-breakpoint-up(lg) {
        margin-bottom: 0;
    }
}
.col-item-xl {
    margin-bottom: $grid-gutter-width;
    @include media-breakpoint-up(xl) {
        margin-bottom: 0;
    }
}
[class^='col-item'], [class*=" col-item"] {
    &:last-child {
        margin-bottom: 0;
    }
}