Skip to content

Instantly share code, notes, and snippets.

View aliciaduffy's full-sized avatar

Alicia Duffy aliciaduffy

View GitHub Profile
@Magnacarter
Magnacarter / plugin-get-prod-images.php
Last active June 25, 2019 15:17
Pull in prod images by setting a live and local url in Production Images Options page
<?php
/**
* Plugin bootstrap file
*
* @link https://github.com/PETAF/plugin-get-prod-images
* @since 1.0.0
* @package PETA\Plugin_Get_Prod_Images\
*
* @wordpress-plugin
* Plugin Name: Plugin Get Prod Images
<?php
function filter_image_url($url){
$liveurl = 'http://www.siteurl.com/';
$localurl = 'http://localhost/yourURL/';
$url = str_replace($localurl, $liveurl, $url);
return $url;
}
add_filter('wp_get_attachment_url', 'filter_image_url');
@gaspanik
gaspanik / bs-config.js
Created June 3, 2014 09:08
Browser-Sync Config for WordPress Theme Dev.
/*
|--------------------------------------------------------------------------
| Browser-sync config file
|--------------------------------------------------------------------------
|
| Please report any issues you encounter:
| https://github.com/shakyShane/browser-sync/issues
|
| For up-to-date information about the options:
| https://github.com/shakyShane/browser-sync/wiki/Working-with-a-Config-File
@mustardBees
mustardBees / functions.php
Last active August 11, 2021 14:40
Filter a few parameters into WordPress YouTube oEmbed requests. Enable modest branding which hides the YouTube logo. Remove the video title and uploader information. Prevent related videos from being shown once the video has played.
<?php
/**
* Filter a few parameters into YouTube oEmbed requests
*
* @link http://goo.gl/yl5D3
*/
function iweb_modest_youtube_player( $html, $url, $args ) {
return str_replace( '?feature=oembed', '?feature=oembed&modestbranding=1&showinfo=0&rel=0', $html );
}
add_filter( 'oembed_result', 'iweb_modest_youtube_player', 10, 3 );
@tinabeans
tinabeans / template.html
Last active February 13, 2024 09:18
A super-barebones single-column responsive email template, assuming a max-width of 540px. Read about it on the Fog Creek blog.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Single-Column Responsive Email Template</title>
<style>
@media only screen and (min-device-width: 541px) {
.content {
@justintadlock
justintadlock / register-post-type.php
Last active June 3, 2024 13:31
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@nciske
nciske / filter-nav-menus.php
Last active July 29, 2022 10:00
Filter nav menus to allow shortcodes in labels and domain agnostic URLs
<?php
// Add a custom menu item with the URL "_SITEURL_/test" and label "[test]" to see it in action
add_filter('wp_nav_menu', 'menu_shortcodes');
function menu_shortcodes( $menu ){
return str_replace('_SITEURL_',preg_replace("~^(?:f|ht)tps?://~i", '', home_url() ), do_shortcode( $menu ) );
}
/* The Grid ---------------------- */
.lt-ie9 .row { width: 940px; max-width: 100%; min-width: 768px; margin: 0 auto; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row.large-collapse .column,
.lt-ie9 .row.large-collapse .columns { padding: 0; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row .row.large-collapse { margin: 0; }
.lt-ie9 .column, .lt-ie9 .columns { float: left; min-height: 1px; padding: 0 15px; position: relative; }
.lt-ie9 .column.large-centered, .columns.large-centered { float: none; margin: 0 auto; }
@labsecrets
labsecrets / bpdev_get_age_from_dob
Created April 13, 2012 19:20 — forked from sbrajesh/bpdev_get_age_from_dob
Get Age from BuddyPress datebox field data
/**
* This now works on both members list and individual profile pages. Note that "birthdate" is name of profile date field - change as needed
* Get Age from BuddyPress date of Birth
* <a href='http://buddypress.org/community/members/param/&#039; rel='nofollow'>@param</a> string $dob_field_name :name of the DOB field in xprofile, like Dob or Date of Birth
* <a href='http://buddypress.org/community/members/param/&#039; rel='nofollow'>@param</a> int $user_id : the user for which you want to retrieve the age
* <a href='http://buddypress.org/community/members/param/&#039; rel='nofollow'>@param</a> string $format: the way you want to print the difference, look t <http://php.net/manual/en/dateinterval.format.php&gt; for the acceptable agrs
* @return string :the formatted age in year/month
*/
function bpdev_get_age_from_dob($birthdate,$user_id=false,$format="%y Years, %m Month(s), %d days"){