Skip to content

Instantly share code, notes, and snippets.

View blainerobison's full-sized avatar

Blaine Robison blainerobison

  • Dagrander Inc.
  • San Diego
View GitHub Profile
@blainerobison
blainerobison / functions.php
Created November 5, 2015 18:02
Remove default link to media file when adding to WYSIWYG editor in WordPress
<?php
/**
* Remove Link When Adding Media
*
* Adding media to a WYSIWYG editor can sometimes automatically include a link
* to the file. This sets the default behavior for all users to none.
*
* @return void
*/
function prefix_media_linking() {
@blainerobison
blainerobison / functions.php
Created November 19, 2015 00:15
Current WordPress URL
<?php echo esc_url( add_query_arg( $wp->query_string, '', home_url( $wp->request ) ) ); ?>
@blainerobison
blainerobison / content.php
Created December 3, 2015 23:35
Add ShareThis social icons to WordPress
<div class="addthis_sharing_toolbox"></div>
@blainerobison
blainerobison / functions.php
Created January 22, 2016 00:04
Use specific template when multiple post types defined via pre_get_posts hook.
<?php
/**
* Modify Main Query
*
* Add multiple post types to main query.
*
* @param object $query main query object
* @return no return value necessary.
*/
function _s_post_type_1_archive( $query ) {
@blainerobison
blainerobison / .htaccess
Created March 30, 2016 18:03
Redirect / Rewrite Rules
# Rewrite url with or without trailing slash, case insensitive
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^path/?$ /new/path/ [NC,L,R=301]
</IfModule>