Skip to content

Instantly share code, notes, and snippets.

@kurtisdunn
Created November 12, 2015 11:54
Show Gist options
  • Save kurtisdunn/56e6d2d1fbb54bf576a0 to your computer and use it in GitHub Desktop.
Save kurtisdunn/56e6d2d1fbb54bf576a0 to your computer and use it in GitHub Desktop.
Example WordPress functions.php
<?php
function site_resources() {
wp_enqueue_style( 'bootstrap-options-style', get_template_directory_uri() . '/css/bootstrap.min.css' );
wp_enqueue_style( 'custom-options-style', get_template_directory_uri() . '/css/custom.min.css' );
wp_enqueue_style( 'font-awesome-options-style', get_template_directory_uri() . '/bower_components/font-awesome/css/font-awesome.min.css' );
wp_enqueue_style( 'animate-options-style', get_template_directory_uri() . '/bower_components/animate.css/animate.min.css' );
}
add_action('wp_enqueue_scripts', 'vitalConsult_resources');
function get_the_blog_excerpt() {
$excerpt = get_the_content();
$excerpt = strip_shortcodes($excerpt);
$excerpt = strip_tags($excerpt);
$the_str = substr($excerpt, 0, 220) . '...';
return $the_str;
}
function new_excerpt_more( $more ) {
return ' <a class="" href="' . get_permalink( get_the_ID() ) . '">' . __( '...', 'your-text-domain' ) . '</a>';
}
add_filter( 'excerpt_more', 'new_excerpt_more' );
// addFeaturedImageSupport
function post_image_support() {
//add image support
add_theme_support('post-thumbnails');
add_image_size('sm', 180, 120, true);
add_image_size('lg', 720, 310, false);
add_image_size('blog_home', 440, 720, false);
}
add_action('after_setup_theme', post_image_support);
function ms_image_editor_default_to_gd( $editors ) {
$gd_editor = 'WP_Image_Editor_GD';
$editors = array_diff( $editors, array( $gd_editor ) );
array_unshift( $editors, $gd_editor );
return $editors;
}
add_filter( 'wp_image_editors', 'ms_image_editor_default_to_gd' );
// Add widget locations
function widgetInit() {
register_sidebar( array(
'name' => 'Sidebar',
'id' => 'Sidebar'
));
}
add_action('widgets_init', widgetInit)
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment