Skip to content

Instantly share code, notes, and snippets.

Avatar

Priscilla Chapman priscillamc

View GitHub Profile
View config.rb
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "."
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"
# To enable sourcemap output, set this to true
View development.md
@priscillamc
priscillamc / bs-config.json
Created Mar 17, 2017
Open Angular project in Chrome instead of default browser.
View bs-config.json
{
"browser" : "chrome"
}
View wp-theme-cheatsheet.md

Display Featured Image, if exists (in loop)

if ( has_post_thumbnail() ){
    the_post_thumbnail();
}

Display theme image

<img src="<?php echo get_styleshet_directory_uri(); ?>/images/logo.png" class="" alt="" />
@priscillamc
priscillamc / wp-theme-checklist.md
Last active Jun 29, 2017
Theme update checklist
View wp-theme-checklist.md

Code

-[ ] Removed debugging code (error_log, console.log, var_dump, dbgx_trace_var)

View vim.md

Convert line endings

Convert to Unix: :set ff=unix Convert to Windows: :set ff=dos

Save and close

:wq

Edit file

i

@priscillamc
priscillamc / git-email-fix
Created Apr 15, 2015
Git fix email settings in branch
View git-email-fix
git config --global user.email
git config --global user.email "username@users.noreply.github.com"
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "email@example.com" ];
then
GIT_AUTHOR_NAME="username";
GIT_AUTHOR_EMAIL="username@users.noreply.github.com";
git commit-tree "$@";
@priscillamc
priscillamc / wp-hide-customizer-admin-links
Created Aug 13, 2015
Remove WordPress Customizer links from the Admin Toolbar and dashboard by changing the body class back to 'no-customize-support'. This is a way to show only the original admin toolbar links for themes that don't support the Customizer.
View wp-hide-customizer-admin-links
@priscillamc
priscillamc / gitignore
Last active Apr 22, 2019
Common gitignore
View gitignore
Thumbs.db
.DS_Store
*.orig
node_modules
.npm-debug.log
@priscillamc
priscillamc / wp-add-inline-scripts.md
Last active Oct 4, 2019
Adding inline javascript in WordPress 4.5+ using wp_add_inline_script()
View wp-add-inline-scripts.md

Adding Inline Scripts in WordPress

Since WordPress 4.5, you can add the inline JavaScript using the wp_add_inline_script() function. This can be used instead of echoing inline scripts using wp_footer. The first argument is the handle of a registered script, in this case 'pretty-photo'.

function add_styles_scripts(){
	// Add script in the footer
	wp_enqueue_script('pretty-photo', get_stylesheet_directory_uri() . '/.../jquery.prettyPhoto.js', 
		array('jquery'), NULL, true);