Skip to content

Instantly share code, notes, and snippets.

View mark-obrien's full-sized avatar

Mark OBrien mark-obrien

  • Minneapolis
View GitHub Profile
/* Add This */
jQuery('.menu-item-has-children').on('click', function(e){
e.preventDefault();
jQuery('ul').removeClass('active');
jQuery(this).find('ul').addClass('active');
});
/*Modify this (Line 8 of custom-scripts.js)*/
jQuery("#it-mobile-menu").click(function(){
jQuery('ul.submenu.active').removeClass('active');
@mark-obrien
mark-obrien / example.php
Created September 24, 2016 01:12
Featured image wit custom field
<?php if(has_post_thumbnail($post->ID)) { ?>
<?php $link = isset(get_post_meta($post->ID, 'custom_field_name', true)) ? get_post_meta($post->ID, 'custom_field_name', true) : ''; ?>
<div class="ft-image">
<a href="<?php echo $link; ?>"><?php echo get_the_post_thumbnail($post->ID); ?></a>
</div>
<?php } ?>
@mark-obrien
mark-obrien / shortcodes.php
Created September 24, 2016 00:50
Add class to employee box shortcode
<?php
add_shortcode('intw_page_header', 'intw_page_header_shortcode');
function intw_page_header_shortcode(){
global $post;
$html = '<div class="page-header-wrapper">';
if(has_post_thumbnail($post->ID)) {
$html = '<div class="has-ft-image-interior-page">';
$html .= get_the_post_thumbnail($post->ID);
<?php
add_shortcode('nci_careers', 'nci_careers_shortcode');
function nci_careers_shortcode(){
$args = ['post_type'=>'careers', 'numberposts'=>-1, 'post_status'=>'publish'];
$careers = get_posts($args);
if(! $careers){
return 'Sorry your are sol';
@mark-obrien
mark-obrien / gist:622850224d42363d7869
Created February 7, 2016 13:21
Add Bootstrap classes to CF7
add_filter('wpcf7_form_elements', 'wpcf7_form_elements');
function wpcf7_form_elements($content) {
$html = $content;
$document = new DOMDocument();
$document->loadHTML($content);
$inputs = $document->getElementsByTagName('input');
foreach ($inputs as $input) {
drush pml --no-core --type=module --status=enabled --pipe | xargs drush -y dis
@mark-obrien
mark-obrien / Vagrantfile
Created August 31, 2015 18:59
Vagrant SSH Auth Error Fix
dir = File.dirname(File.expand_path(__FILE__))
require 'yaml'
require "#{dir}/puphpet/ruby/deep_merge.rb"
configValues = YAML.load_file("#{dir}/puphpet/config.yaml")
if File.file?("#{dir}/puphpet/config-custom.yaml")
custom = YAML.load_file("#{dir}/puphpet/config-custom.yaml")
configValues.deep_merge!(custom)
@mark-obrien
mark-obrien / Composer
Last active April 21, 2016 13:27
Composer Install
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/query.php
*/
$args = array(