Skip to content

Instantly share code, notes, and snippets.

@ellenmva
ellenmva / functions.php
Created November 1, 2012 23:05
Add Site Title to Display with Logo - Branding Section Pagelines
// Adds Site Title to Display with Logo in Branding Section ------- //
add_action('pagelines_before_branding_icons', 'branding_site_title');
function branding_site_title(){
?>
<div class="title-container">
<a class="home site-title" href="<?php echo get_option(‘home’); ?>/">
<?php bloginfo(‘name’); ?></a></div>
@ellenmva
ellenmva / gist:4027846
Created November 6, 2012 21:54
Child Page Menu Before Primary Sidebar Pagelines
/**
* List child pages in content area
*/
function base_list_children() {
global $post;
$page_ID = $post->ID;
$ancestors = get_post_ancestors($page_ID);
$children = wp_list_pages("child_of=$page_ID&echo=0");
@ellenmva
ellenmva / Colorpicker Metafield
Created September 14, 2013 23:20
Create a color meta field
function __construct() {
add_action( 'admin_enqueue_scripts', array(&$this,'em_enqueue_color_picker' ));
add_action('admin_head', array(&$this,'add_colorpicker_script'));
}
function em_enqueue_color_picker( $hook_suffix ) {
// first check that $hook_suffix is appropriate for your admin page
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker' , false, true );
}
function adjustBrightness($hex, $steps) {
// Steps should be between -255 and 255. Negative = darker, positive = lighter
$steps = max(-255, min(255, $steps));
// Format the hex color string
$hex = str_replace('#', '', $hex);
if (strlen($hex) == 3) {
$hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2);
}
@ellenmva
ellenmva / font-line-height
Created September 17, 2013 18:59
Fix for font size and line height to match primary font size and line height.
.hentry ul, .hentry ol {
font-size: @plFontSize;
line-height: @plFontSize * 1.55;
}
@ellenmva
ellenmva / business-branding-site-title
Created September 17, 2013 19:57
Makes the site title use the header font
#page .section-business-branding .bb-site-title {
font-family: @plHeaderFont;
}
@ellenmva
ellenmva / acf-translate.php
Created November 4, 2013 22:28
Translate ACF Fields
function acf_translate_fields( $field ){
$field['label' ] = __( $field['label' ], 'plugin-slug' );
$field['instructions' ] = __( $field['instructions' ], 'plugin-slug' );
return $field;
}
add_filter('acf/load_field', array($this,'acf_translate_fields'));
@ellenmva
ellenmva / template-chooser
Created November 6, 2013 13:59
Nick's template chooser
add_filter( 'template_include', array($this,'template_chooser'));
function template_chooser( $template ) {
// Post ID
$post_id = get_the_ID();
// For all other CPT
if ( get_post_type( $post_id ) != 'projects' ) {
return $template;
}
@ellenmva
ellenmva / custom-fields-shortcode.php
Created November 7, 2013 13:10
Execute Shortcodes inside custom fields
<?php echo apply_filters('the_content', get_post_meta($post->ID, 'your_custom_field_here', true)); ?>
@ellenmva
ellenmva / acf-check.php
Created November 7, 2013 21:43
check for acf
global $acf;
if( !$acf )
{
define( 'ACF_LITE' , true );
include_once('advanced-custom-fields/acf.php' );
}