Skip to content

Instantly share code, notes, and snippets.

View ihorvorotnov's full-sized avatar
🇺🇦
Working remotely since 1999

Ihor Vorotnov ihorvorotnov

🇺🇦
Working remotely since 1999
View GitHub Profile
<?php
/**
* Must-Use Functions
*
* A class filled with functions that will never go away upon theme deactivation.
*
* @package WordPress
* @subpackage GRD
*/
class GRD_Functions {
<?php
/**
* A class filled with functions that will never go away upon theme deactivation
*
* @package WordPress
* @subpackage GRD
* @version 0.1.0
*/
class GRD_Functions {
scp -r username@remotehost.com:wordpress /local/wordpress
@ihorvorotnov
ihorvorotnov / wp_links_includes.php
Created May 8, 2015 14:31
Proper linking in WordPress theme templates
@ihorvorotnov
ihorvorotnov / scp_rsync_wp
Created May 8, 2015 14:41
scp / rsync WP files to / from remote server
# From remote to local
scp -r user@11.22.33.44:/var/www/mysite/htdocs/ /local/path/
# From local to remote
scp -r local_dir user@11.22.33.44:/var/www/mysite/htdocs/
# Rsync remote dir with local one
# reverse local and remote to change direction
rsync -rvz --exclude "exclude_dir" --progress user@11.22.33.44:/var/www/mysite/htdocs/ /local/path/'
@ihorvorotnov
ihorvorotnov / script.js
Last active August 28, 2022 11:08
Using wp_is_mobile() in WordPress to detect mobile users (phones and tablets)
jQuery( document ).ready( function($) {
if ( $( "body" ).hasClass("wp-is-mobile"){
/* Do javascript for mobile */
}
else{
/* Do javascript for non-mobile */
}
});
@ihorvorotnov
ihorvorotnov / mobile_tablet.php
Created May 8, 2015 15:34
Custom function to separate phones and tablets with wp_is_mobile() function
<?php
/**
* It's just an example, proof of concept.
* You should modify it to include more tablets, not only iPad.
*/
function my_wp_is_mobile() {
static $is_mobile;
if ( isset($is_mobile) )
<?php # -*- coding: utf-8 -*-
declare( encoding = 'UTF-8' );
/**
* Plugin Name: Defer Contact Form 7 Scripts
* Description: Adds <code>defer='defer'</code> to enqueued javascripts.
* Version: 1.0
* Required: 3.3
* Author: Thomas Scholz
* Author URI: http://toscho.de
* License: GPL
@ihorvorotnov
ihorvorotnov / .editorconfig
Created May 25, 2015 23:30
WordPress Core .editorconfig
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/
root = true
[*]
charset = utf-8
<?php
/* Register custom post types on the 'init' hook. */
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 0.1.0
* @access public