Skip to content

Instantly share code, notes, and snippets.

View saqibsarwar's full-sized avatar

Muhammad Saqib Sarwar saqibsarwar

View GitHub Profile
@saqibsarwar
saqibsarwar / disable-css-animation
Created September 22, 2014 07:59
Disable CSS3 Animation
.animated{
/*CSS transitions*/
-o-transition-property: none !important;
-moz-transition-property: none !important;
-ms-transition-property: none !important;
-webkit-transition-property: none !important;
transition-property: none !important;
/*CSS transforms*/
-o-transform: none !important;
-moz-transform: none !important;
@saqibsarwar
saqibsarwar / social links user profile
Last active August 29, 2015 14:07
Add social links to user profile page
select {
padding: 10px;
border: 1px solid #e7e7e7;
border-radius: 0;
background: #fff url("../images/select-arrow.png") no-repeat 96% center;
/* for chrome & safari */
-webkit-appearance:none;
/* for firefox */
@saqibsarwar
saqibsarwar / only-safari-browser
Created February 25, 2015 15:20
Target only safari browser
if ( navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 ){
// Yep, it's Safari =)
$('body').addClass('safari');
}
@saqibsarwar
saqibsarwar / load-translation-from-child.php
Last active December 21, 2015 11:09
Load translations from child theme
<?php
if ( !function_exists( 'inspiry_load_translation_from_child' ) ) {
/**
* Load translation files from child theme
*/
function inspiry_load_translation_from_child() {
load_child_theme_textdomain ( 'framework', get_stylesheet_directory () . '/languages' );
}
add_action ( 'after_setup_theme', 'inspiry_load_translation_from_child' );
}
@saqibsarwar
saqibsarwar / default-image-sizes.php
Last active June 15, 2016 19:25
Display list default image sizes in WordPress with related dimensions.
<?php
$image_sizes = get_intermediate_image_sizes();
foreach( $image_sizes as $image_size ){
$holder_width = get_option( $image_size . '_size_w' );
$holder_height = get_option( $image_size . '_size_h' );
echo $image_size . ":" . $holder_width . " x " . $holder_height;
}
@saqibsarwar
saqibsarwar / initialize-defaults.php
Last active April 11, 2016 13:01
Helper function to initialize default values for settings as customizer api do not do so.
<?php
if ( ! function_exists( 'inspiry_initialize_defaults' ) ) :
/**
* Helper function to initialize default values for settings as customizer api do not do so.
*
* @param WP_Customize_Manager $wp_customize
* @param $inspiry_settings_ids
*/
function inspiry_initialize_defaults( WP_Customize_Manager $wp_customize, $inspiry_settings_ids ) {
if ( is_array( $inspiry_settings_ids ) && ! empty( $inspiry_settings_ids ) ) {
<?php
if ( ! function_exists( 'inspiry_single_post_customizer' ) ) :
function inspiry_single_post_customizer( WP_Customize_Manager $wp_customize ) {
/**
* Single Post Section
*/
$wp_customize->add_section( 'inspiry_single_post_options', array (
'title' => __( 'Single Post', 'inspiry' ),
'priority' => 123,
<?php
if ( ! function_exists( 'inspiry_single_post_defaults' ) ) :
/**
* Set default values for single post settings
*
* @param WP_Customize_Manager $wp_customize
*/
function inspiry_single_post_defaults( WP_Customize_Manager $wp_customize ) {
$single_post_settings_ids = array(
'inspiry_post_layout',
<?php
if ( ! function_exists( 'inspiry_initialize_defaults' ) ) :
/**
* Helper function to initialize default values for settings as customizer api do not do so by default.
*
* @param WP_Customize_Manager $wp_customize
* @param $inspiry_settings_ids
*/
function inspiry_initialize_defaults( WP_Customize_Manager $wp_customize, $inspiry_settings_ids ) {
if ( is_array( $inspiry_settings_ids ) && ! empty( $inspiry_settings_ids ) ) {