Skip to content

Instantly share code, notes, and snippets.

View pagelab's full-sized avatar
🚀

Márcio Duarte pagelab

🚀
View GitHub Profile
<?php
/**
* Adds a simple WordPress pointer to Settings menu
*/
function thsp_enqueue_pointer_script_style( $hook_suffix ) {
// Assume pointer shouldn't be shown
$enqueue_pointer_script_style = false;
<?php
# License: Public Domain
# I recommend replacing 'my_' with your own prefix.
function my_template_path() {
return My_Wrapping::$main_template;
}
<?php namespace PaintedCloud\WP\Classes;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class CustomTaxonomy {
protected $textdomain;
protected $taxonomies;
public function __construct ( $textdomain )
<?php namespace PaintedCloud\WP\Classes;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class CustomPost {
protected $textdomain;
protected $posts;
public function __construct( $textdomain )
function my_load_meta() {
$script = '/js/script.js';
wp_enqueue_script( 'my-tools', get_template_directory_uri().$script, null, my_version_hash($script) );
$stylesheet = '/style.css';
wp_enqueue_style( 'my-style', get_template_directory_uri().$stylesheet, null, my_version_hash($stylesheet) );
}
add_action('wp_enqueue_scripts', 'my_load_meta');
// Create a hash of the file and pass it back for caching purposes
function my_version_hash($file) {
<?php
/**
* Show Mad Mimi subscriber count w/cache.
*/
function jm_madmimi_subscribers() {
$email = '';
$api = '';
// check and get cached subscriber count
@pagelab
pagelab / functions.php
Created April 10, 2014 17:46
Changing WordPress Theme Customizer default options
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->get_control( 'background_color' )->section = 'background_image';
$wp_customize->get_section( 'background_image' )->title = 'Background Settings';
$wp_customize->get_section( 'title_tagline' )->title = 'Site Title / Logo';
$wp_customize->get_section( 'static_front_page' )->title = 'Home Page Settings';
$wp_customize->get_section( 'static_front_page' )->priority = 29;
@pagelab
pagelab / critical-rendering-path.html
Created May 1, 2014 13:44
Measuring Critical Rendering Path with navigation timing (Google)
<html>
<head>
<title>Critical Path: Measure</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link href="style.css" rel="stylesheet">
<script>
function measureCRP() {
var t = window.performance.timing,
interactive = t.domInteractive - t.domLoading,
@-webkit-keyframes float-up {
0% { opacity: 0; top: 4rem; }
100% { opacity: 1; top: 0; }
}
.float-up {
opacity: 0;
position: relative;
-webkit-animation-name: float-up;
-webkit-animation-duration: .3s;
<?php
add_action( 'tgmpa_register', 'register_required_plugins' );
// This function is called from the above hook
function register_required_plugins()
{
// The plugins array allows us to define multiple plugins we want to include.
// The commented out example shows how we can include and activation a bundled
// plugin zip file in our theme.