Skip to content

Instantly share code, notes, and snippets.

View tedgeving's full-sized avatar

ted tedgeving

View GitHub Profile
@tedgeving
tedgeving / functions.php
Last active February 26, 2020 18:50
Useful WordPress Snippets
<?php
/**
* WordPress snippets, add to functions.php
* 1.) Enqueue Google Fonts
* 2.) Disbale emoji support
* 3.) Enqueue style sheets in a specific order
* 4.) Enqueue a single Javascript file correctly
* 5.) Enqueue jQuery correctly
*/
@tedgeving
tedgeving / header.php
Last active February 26, 2020 18:25
Add featured image to a WordPress page
<?php
/**
* Themes must declare support for the Featured Image function before
* the Featured Image interface will appear on the Edit screen.
* add_theme_support( 'post-thumbnails' );
* https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
?>
<?php if (has_post_thumbnail()):
$image_url = wp_get_attachment_image_src( get_post_thumbnail_id());
@tedgeving
tedgeving / functions.php
Created April 25, 2016 20:25
Set a different Wordpress Admin Color Scheme for each development environment.
<?php
/*
* Set a different Wordpress Admin Color Scheme for each development environment.
* Add this function to the Wordpress functions.php file and make the necessary
* changes to $hosts array().
* Wordpress Default Admin Color themes: default, light, blue, coffee, ectoplasm, midnight, ocean, sunrise
*/
function custom_env_admin_themes(){
//Change the host name and add additional hosts as key/value pairs to this array.
@tedgeving
tedgeving / gravityforms.scss
Created December 22, 2015 20:58 — forked from JodiWarren/gravityforms.scss
Style Gravity Forms with Bootstrap 3 (SASS) - From: http://roots.io/style-gravity-forms-with-bootstrap/
.gform_wrapper ul {
@extend .list-unstyled;
}
.gform_wrapper li {
@extend .form-group;
}
.gform_wrapper form {
margin-bottom: 0;
}
.gform_wrapper .gfield_required {
@tedgeving
tedgeving / wordpress-bootstraps-row-columns-example.php
Last active October 28, 2015 16:55
Display a list of Wordpress pages with Bootstrap rows and columns markup. This example has 3 items to a row. (3 by N number of rows)
<?php
/**
* Display a list of Worpress pages with Bootstrap rows and columns markup. This example has 3 items to a row. (3 by N number of rows)
*/
$pages = get_posts(array( 'orderby' => 'menu_order', 'post_type' => 'pages', 'numberposts' => -1, 'order'=> 'ASC' ));
$totalpages = count($pages);
$count =0;
@tedgeving
tedgeving / .gitignore
Created February 28, 2014 21:52 — forked from redoPop/.gitignore
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your