Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* The header for our theme.
*
* Displays all of the <head> section and everything up till <div id="content">
*
* @package _s
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<?php
/**
* Enqueue scripts and styles.
*/
function presentation_lite_parent_scripts() {
wp_enqueue_style( 'presentation-lite-parent-style', get_template_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'presentation_lite_parent_scripts', 9 );
@grappler
grappler / functions.php
Last active August 29, 2015 14:10
Extended mobile menu title for Responsive Mobile
<?php
function responsive_extended_mobile_menu_title( $page_title ) {
if ( is_front_page() ) {
$page_title = __( 'Home', 'responsive-mobile' );
} elseif ( is_home() ) {
$page_title = __( 'Blog', 'responsive-mobile' );
} elseif ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
// @TODO Display porudct name on single product page
$page_title = woocommerce_page_title();
} elseif ( is_archive() ) {
@grappler
grappler / wpml-config.xml
Created December 7, 2014 21:49
EDD wpml-config.xml
<wpml-config>
<custom-types>
<custom-type translate="1">download</custom-type>
<custom-type translate="0">edd_payment</custom-type>
</custom-types>
<custom-fields>
<custom-field action="ignore">_edd_download_earnings</custom-field>
<custom-field action="ignore">_edd_download_sales</custom-field>
<custom-field action="copy">edd_price</custom-field>
<custom-field action="copy">edd_variable_prices</custom-field>
@grappler
grappler / functions.php
Created February 11, 2015 18:50
Escaping for textarea values while leaving both double and single quotes unconverted.
<?php
/**
* Escaping for textarea values while leaving both double and single quotes unconverted.
*
* @param string $text
* @return string
*/
function theme_slug_esc_text( $text ) {
return htmlspecialchars( $text, ENT_NOQUOTES, get_option( 'blog_charset' ) );
}

Clone repo

Run following code to clone from GitHub. git clone git@github.com:grappler/WPZOO.git

Install dependencies

Run composer to install the dependencies composer install

@grappler
grappler / dabblet.css
Created November 9, 2012 21:57
Untitled
div {
text-align: center;
background: grey;
float:left
}
.one-col {
width: 100%
}
.two-col {
width: 50%
@grappler
grappler / index.html
Created November 11, 2012 06:23
A CodePen by grappler.
<div class="one-col">
One Coloumn
</div>
<div class="two-col">
Two Coloumn
</div>
<div class="two-col">
Two Coloumn
</div>
<div class="three-col">
@grappler
grappler / functions.php
Created November 18, 2012 19:44 — forked from isGabe/functions.php
Auto versioning of CSS/JS files in WordPress
/*
Auto-version CSS & JS files, allowing for cache busting when these files are changed.
Place in functions.php or wherever you are enqueueing your scripts & styles
Avoids using query strings which prevent proxy caching
Adjust paths based on your theme setup. These paths work with Bones theme
*/

Adding context to strings

A word or phrase may be ambiguous to a translator who will likely only see the string in the interface of their translation tool and not necessarily on the front-end of your theme. Ambiguity can arise when a term is used in more than one context.

The functions _x() or _ex() are used to add the context to a string. They are similar to __() and _e(), but have a comment as an additional argument.

The function can be used in differnt ways

  • Explain the use for words with double meaings
  • Give extra information about the string