Skip to content

Instantly share code, notes, and snippets.

@neverything
Created January 23, 2013 18:14
Show Gist options
  • Save neverything/4611188 to your computer and use it in GitHub Desktop.
Save neverything/4611188 to your computer and use it in GitHub Desktop.
/**
* Here goes all the JS Code you need in your child theme buddy!
*/
(function($) {
$('.percentage').easyPieChart({
animate: 1000
});
$('.percentage-light').easyPieChart({
barColor: function(percent) { // does not work on update
percent = 100;
return "rgb(" + Math.round(255 * (1-percent)) + ", " + Math.round(255 * percent) + ", 0)";
},
trackColor: '#666',
scaleColor: false,
lineCap: 'butt',
lineWidth: 15,
animate: 1000
});
$('.updateEasyPieChart').on('click', function(e) {
e.preventDefault();
$('.percentage, .percentage-light').each(function() {
var newValue = Math.round(100*Math.random());
$(this).data('easyPieChart').update(newValue);
$('span', this).text(newValue);
});
});
}(jQuery));
<?php
/**
* This makes the child theme work. If you need any
* additional features or let's say menus, do it here.
*
* @return void
*/
function required_starter_themesetup() {
load_child_theme_textdomain( 'requiredstarter', get_template_directory() . '/languages' );
// Register an additional Menu Location
register_nav_menus( array(
'meta' => __( 'Meta Menu', 'requiredstarter' )
) );
// Add support for custom backgrounds and overwrite the parent backgorund color
add_theme_support( 'custom-background', array( 'default-color' => 'f7f7f7' ) );
}
add_action( 'after_setup_theme', 'required_starter_themesetup' );
/**
* With the following function you can disable theme features
* used by the parent theme without breaking anything. Read the
* comments on each and follow the link, if you happen to not
* know what the function is for. Remove the // in front of the
* remove_theme_support('...'); calls to make them execute.
*
* @return void
*/
function required_starter_after_parent_theme_setup() {
/**
* Hack added: 2012-10-04, Silvan Hagen
*
* This is a hack, to calm down PHP Notice, since
* I'm not sure if it's a bug in WordPress or my
* bad I'll leave it here: http://wordpress.org/support/topic/undefined-index-custom_image_header-in-after_setup_theme-of-child-theme
*/
if ( ! isset( $GLOBALS['custom_image_header'] ) )
$GLOBALS['custom_image_header'] = array();
if ( ! isset( $GLOBALS['custom_background'] ) )
$GLOBALS['custom_background'] = array();
// Remove custom header support: http://codex.wordpress.org/Custom_Headers
//remove_theme_support( 'custom-header' );
// Remove support for post formats: http://codex.wordpress.org/Post_Formats
//remove_theme_support( 'post-formats' );
// Remove featured images support: http://codex.wordpress.org/Post_Thumbnails
//remove_theme_support( 'post-thumbnails' );
// Remove custom background support: http://codex.wordpress.org/Custom_Backgrounds
//remove_theme_support( 'custom-background' );
// Remove automatic feed links support: http://codex.wordpress.org/Automatic_Feed_Links
//remove_theme_support( 'automatic-feed-links' );
// Remove editor styles: http://codex.wordpress.org/Editor_Style
//remove_editor_styles();
// Remove a menu from the theme: http://codex.wordpress.org/Navigation_Menus
//unregister_nav_menu( 'secondary' );
}
add_action( 'after_setup_theme', 'required_starter_after_parent_theme_setup', 11 );
/**
* Add our theme specific js file and some Google Fonts
* @return void
*/
function required_starter_scripts() {
/**
* Registers the child-theme.js
*
* Remove if you don't need this file,
* it's empty by default.
*/
wp_enqueue_script(
'child-theme-js',
get_stylesheet_directory_uri() . '/javascripts/child-theme.js',
array( 'theme-js', 'easy-pie-js' ),
required_get_theme_version( false ),
true
);
/**
* Registers the jquery.easy-pie-chart.js
*/
wp_enqueue_script(
'easy-pie-js',
get_stylesheet_directory_uri() . '/javascripts/jquery.easy-pie-chart.js',
array( 'jquery' ),
'1.3.3',
true
);
/**
* Enqeues the jquery.easy-pie-chart.css
*/
wp_enqueue_style(
'easy-pie-css',
get_stylesheet_directory_uri() . '/stylesheets/jquery.easy-pie-chart.css',
array(),
'1.3.3'
);
/**
* Registers the app.css
*
* If you don't need it, remove it.
* The file is empty by default.
*/
wp_register_style(
'app-css', //handle
get_stylesheet_directory_uri() . '/stylesheets/app.css',
array( 'foundation-css' ), // needs foundation
required_get_theme_version( false ) //version
);
wp_enqueue_style( 'app-css' );
/**
* Adding google fonts
*
* This is the proper code to add google fonts
* as seen in TwentyTwelve
*/
$protocol = is_ssl() ? 'https' : 'http';
$query_args = array( 'family' => 'Open+Sans:300,600' );
wp_enqueue_style(
'open-sans',
add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ),
array(),
null
);
}
add_action('wp_enqueue_scripts', 'required_starter_scripts');
/**
* Overwrite the default continue reading link
*
* This function is an example on how to overwrite
* the parent theme function to create continue reading
* links.
*
* @return string HTML link with text and permalink to the post/page/cpt
*/
function required_continue_reading_link() {
return ' <a class="read-more" href="'. esc_url( get_permalink() ) . '">' . __( ' Read on! &rarr;', 'requiredstarter' ) . '</a>';
}
/**
* Overwrite the defaults of the Orbit shortcode script
*
* Accepts all the parameters from http://foundation.zurb.com/docs/orbit.php#optCode
* to customize the options for the orbit shortcode plugin.
*
* @param array $args default args
* @return array your args
*/
function required_obrit_script_args( $defaults ) {
$args = array(
'animation' => 'fade',
'advanceSpeed' => 8000,
);
return wp_parse_args( $args, $defaults );
}
add_filter( 'req_obrit_script_args', 'required_obrit_script_args' );
@1213ramesh
Copy link

only menu bar displaying purpose which code will be write?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment