Skip to content

Instantly share code, notes, and snippets.

View SenecaOne's full-sized avatar

Jen Huls SenecaOne

View GitHub Profile
@SenecaOne
SenecaOne / README.MD
Last active September 10, 2015 18:19
WordPress & ACF: Assign post author from frontend

When using Advanced Custom Fields, to use a "User" field as a post author assignment on the front-end, you need to place code in the functions.php file and then the acf_form() code in the theme template.

@SenecaOne
SenecaOne / gist:f17fd8538ab8790334da
Last active August 29, 2015 14:27 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# First:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
#go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@SenecaOne
SenecaOne / Wordpress Interchange
Last active August 29, 2015 14:27 — forked from joshrainwater/Wordpress Interchange
Foundation Interchange + Wordpress Featured Images
<?php
function theme_support() {
add_theme_support('post-thumbnails');
// default thumb size
set_post_thumbnail_size(500, 320, true);
// Add thumbnail sizes for various screen sizes and locations
@SenecaOne
SenecaOne / gforms-ga-function.php
Created May 20, 2015 14:25
Gravity Forms GA function
<?php
// track conversions in Gravity Forms
// Change eventCategory, eventAction, and eventLabel for own campaigns
// Change the form id in add_filter
function add_conversion_tracking_code($button, $form) {
$dom = new DOMDocument();
$dom->loadHTML($button);
$input = $dom->getElementsByTagName('input')->item(0);
if ($input->hasAttribute('onclick')) {
$input->setAttribute("onclick","ga('send', 'event', { eventCategory: 'Forms', eventAction: 'Mailing List Subscription', eventLabel: 'Sidebar'});".$input->getAttribute("onclick"));
@SenecaOne
SenecaOne / button.php
Created April 27, 2015 19:10
Pass ID to form field in Gravity Forms
<?php /* Add a custom data attribute to the button that fires the modal. This is what jQuery pulls the data from. */ ?>
<a class="button modalButton-banner" href="#" data-reveal-id="siteModal-banner" data-mail-id="<?php echo $mail_id; ?>"><?php echo $button_text ?></a>
@SenecaOne
SenecaOne / auto-copyright-js
Created March 23, 2015 12:40
JS Auto Copyright
@SenecaOne
SenecaOne / wordpress-echo-variables
Created March 23, 2015 12:39
WordPress echo variables
# Example usage
/*<?php
$facebook = get_theme_mod( $facebook_link, $default );
if ($facebook !== $default) {
$fb_icon .="<a href='".$facebook."'>FB Icon</a>";
echo $facebook;
}
?>*/
$variable_name .= "<a href='".$meta_values."'>";
echo $variable_name;
@SenecaOne
SenecaOne / wp-enqueue-google-fonts
Created March 23, 2015 12:37
WordPress enqueue google fonts
<?php
function load_fonts() {
wp_register_style('googleFonts', 'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800');
wp_enqueue_style( 'googleFonts');
}
add_action('wp_print_styles', 'load_fonts');
@SenecaOne
SenecaOne / deregister-parent-scripts-wp
Created March 23, 2015 12:36
Deregister Parent CSS/Scripts WordPress
<?php
function PREFIX_remove_scripts() {
wp_dequeue_style( 'screen' );
wp_deregister_style( 'screen' );
wp_dequeue_script( 'site' );
wp_deregister_script( 'site' );
// Now register your styles and scripts here
}
@SenecaOne
SenecaOne / wp-if-is-mobile
Created March 23, 2015 12:35
WordPress if (is_mobile)
<?php if ( wp_is_mobile() ) : ?>
/* Display and echo mobile specific stuff here */
<?php else: ?>
<?php endif ?>