Skip to content

Instantly share code, notes, and snippets.

View designbuildtest's full-sized avatar

designbuildtest

View GitHub Profile
@designbuildtest
designbuildtest / gist:b140e21180348df4c5c0
Last active August 29, 2015 14:01
Customizer logo function
<?php
/**
* Custom site logo function.
*
* Check if a site logo has been uploaded. If a site logo is present, query the database to retrieve
* the medium sized version of the image. This function prevents excessively large logo images being
* displayed on the frontend.
*/
function twentyfourteen_site_logo() {
$site_logo = get_theme_mod( 'site_logo' );
@designbuildtest
designbuildtest / gist:e31d3385edbb070ed24f
Last active August 29, 2015 14:01
Use full version of FlexSlider in twentyfourteen theme
<?php
/** Remember to remove the below featuredslider (note custom name) js stuff in functions.js file
*
_window.load( function() {
if ( body.is( '.slider' ) ) {
$( '.featured-content' ).featuredslider( {
selector: '.featured-content-inner > article',
controlsContainer: '.featured-content'
} );
@designbuildtest
designbuildtest / gist:4ae2c9206d74d14b185a
Last active August 29, 2015 14:01
Disable WordPress Media Attachment Comments
<?php
/*
* http://www.wpbeginner.com/wp-tutorials/how-to-disable-comments-on-wordpress-media-attachments/
*/
function filter_media_comment_status( $open, $post_id ) {
$post = get_post( $post_id );
if( $post->post_type == 'attachment' ) {
return false;
}
return $open;
@designbuildtest
designbuildtest / gist:603577e0047365b4368f
Created May 26, 2014 23:22
Add a home link to wp_page_menu() by default
<?php
/**
* Add a home link to wp_page_menu() by default
*/
function twentyfourteen_page_menu_args( $args ) {
$show_on_front = get_option('show_on_front');
if ( $show_on_front == 'posts' ) {
$args['show_home'] = true;
}
return $args;
@designbuildtest
designbuildtest / gist:132b5167297c628f9eb8
Last active August 29, 2015 14:02
Google Map integration
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["map"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
<?php
// Slider autoplay toggle.
$wp_customize->add_setting( 'slider_autoplay', array(
'default' => 'disabled',
'sanitize_callback' => 'twentyfourteen_sanitize_slider_autoplay',
) );
$wp_customize->add_control( 'slider_autoplay', array(
'label' => __( 'Slider Autoplay', 'twentyfourteen' ),
'section' => 'featured_content',
@designbuildtest
designbuildtest / gist:e6dfb85a7c0ee897ebce
Last active August 29, 2015 14:02
Customizer dropdown pages
<?php
$wp_customize->add_setting( 'select_page', array(
'default' => '',
) );
$wp_customize->add_control( 'map_page_control', array(
'label' => __( 'Select page', 'twentyfourteen' ),
'section' => 'theme_options',
'settings' => 'select_page',
<?php // Map page
if ( get_theme_mod( 'map_page' ) ) {
$map_page_id = get_theme_mod( 'map_page' ); ?>
<div class="location-map">
<a href="<?php echo esc_url( get_permalink( $map_page_id ) ); ?>" title="<?php echo esc_attr( get_the_title( $map_page_id ) ); ?>">
<?php echo esc_attr( get_the_title( $map_page_id ) ); ?>
</a>
</div><?php
} ?>
@designbuildtest
designbuildtest / gist:4d0907b06075cf7c7399
Created June 19, 2014 02:45
InfoWindow open on page load
var infowindow = new google.maps.InfoWindow({
map: map,
position: pos,
content: '<?php echo get_the_title(); ?>'
});
<?php
// Add social media text inputs.
$social_media_array = array(
__( 'Facebook', 'twentyfourteen' ) => 'facebook',
__( 'Flickr', 'twentyfourteen' ) => 'flickr',
__( 'Google+', 'twentyfourteen' ) => 'googleplus',
__( 'Instagram', 'twentyfourteen' ) => 'instagram',
__( 'LinkedIn', 'twentyfourteen' ) => 'linkedin',
__( 'Pinterest', 'twentyfourteen' ) => 'pinterest',
__( 'Skype', 'twentyfourteen' ) => 'skype',