View scrollbar_width.js
function get_scroll_bar_width() {
var $outer = $( '<div>' ).css( {visibility: 'hidden', width: 100, overflow: 'scroll'} ).appendTo( 'body' ),
width_with_scroll = $( '<div>' ).css( {width: '100%'} ).appendTo( $outer ).outerWidth();
$outer.remove();
return 100 - width_with_scroll;
}
View .eslintrc
{
"root": true,
"globals": {
"_": false,
"$": false,
"Backbone": false,
"JSON": false,
"jQuery": false,
"wp": false
},
View dashboard-widget.php
<?php
/**
* Dashboard widget
*
* @package WordPress
* @version 1.0.0
* @author Denis Žoljom <denis.zoljom@gmail.com>
* @license GNU General Public License v2 or later
* @link http://madebydenis.com/
* @since 1.0.0
View expanded_html_tags.php
if ( ! function_exists( 'html_allowed_tags' ) ) {
/**
* Allowed tags function for wp_kses()
*
* @return array Array of allowed HTML tags
* @since 1.0.0
*/
function html_allowed_tags() {
return array(
'a' => array(
View embedd.php
<?php
/**
* Contains the post embed base template
*
* When a post is embedded in an iframe, this file is used to create the output
* if the active theme does not include an embed.php template.
*
* @package madebydenis
* @subpackage oEmbed
* @since 4.4.0
View functions.php
<?php
/**
* Your theme functions and definitions
*
* Set up the theme and provides some helper functions, which are used in the
* theme as custom template tags. Others are attached to action and filter
* hooks in WordPress to change core functionality.
*
* @package WordPress
* @subpackage yourtheme
View test.js
// iOS double click issue on menu
$('nav > ul > li a').on('touchend', function(event) {
window.location.href = $(this).attr('href');
});
// Doubleclick prevent; from http://stackoverflow.com/a/28566136/629127
function my_function(e) {
var $this = $( e.currentTarget );
e.preventDefault();
if ( ! $this.data( 'lockedAt' ) || + new Date() - $this.data( 'lockedAt' ) > 300 ) {
View simple-vies-check.php
<?php
add_action( 'wp_ajax_simple_vies_check', 'simple_vies_check' );
add_action( 'wp_ajax_nopriv_simple_vies_check', 'simple_vies_check' );
if ( ! function_exists( 'simple_vies_check' ) ) {
/**
* AJAX VIES check function for WooCommerce checkout
*
* @since 1.0.0
View additional_menu_items.php
<?
// Check if the WooCommerce plugin is activated.
if (in_array('woocommerce/woocommerce.php', get_option('active_plugins')) ) {
add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
}
/**
* Add login/my account link
*
* Adding additional link to header menu. Be sure that your menu location is named
* header-menu, othervise this won't work.
View filter.php
add_action('restrict_manage_posts', 'filter_hours_post_by_user');
/**
* Display a custom dropdown in hours page (filter)
*
* Filters posts only by one user.
*
* @since 1.0.0
*/
function filter_hours_post_by_user() {
$type = 'hours';