Skip to content

Instantly share code, notes, and snippets.

@shazdeh
shazdeh / gist:7332067
Created November 6, 2013 07:01
Disable the Builder frontpage editor
<?php
function disable_frontend_builder() {
global $ThemifyBuilder;
if( ! is_admin() ) {
remove_action( 'wp_enqueue_scripts', array( $ThemifyBuilder, 'load_front_js_css' ), 10 );
remove_action( 'wp_before_admin_bar_render', array( $ThemifyBuilder, 'builder_admin_bar_menu'), 1000 );
}
}
@shazdeh
shazdeh / gist:7291827
Last active December 27, 2015 07:49
Customizing the site titles per-page using a custom field
<?php
function custom_site_title( $html, $location, $logo_tag, $type ) {
global $post;
if( is_singular() && $custom_title = get_post_meta( $post->ID, 'site_title', true ) ) {
$title = get_bloginfo('name');
$html = str_replace( $title, $custom_title, $html );
}
return $html;
}
@shazdeh
shazdeh / gist:7291432
Created November 3, 2013 15:25
Disabling the post edit links from frontpage
<?php
if( ! is_admin() ) {
add_filter( 'get_edit_post_link', '__return_null' );
}
function restore_admin_bar_edit_link() {
remove_filter( 'get_edit_post_link', '__return_null' );
}
add_action( 'wp_footer', 'restore_admin_bar_edit_link' );
@shazdeh
shazdeh / gist:7288662
Created November 3, 2013 10:14
Filtering options in a Themify theme. The $options variable is an array of saved options.
<?php
$theme = wp_get_theme();
function filter_theme_options( $options ) {
return $options;
}
add_filter( 'option_' . $theme->display('Name') . '_themify_data', 'filter_theme_options' );
@shazdeh
shazdeh / gist:7288642
Created November 3, 2013 10:12
Customizing date formats. PHP reference: http://php.net/manual/en/function.date.php
<?php
function custom_date_format( $format ) {
return 'M j, Y';
}
add_filter( 'themify_loop_date', 'custom_date_format' );