Skip to content

Instantly share code, notes, and snippets.

@omurphy27
omurphy27 / gist:ba14d26c7e0315eacb31
Last active August 29, 2015 14:20
Access Advanced Custom Fields on Wordpress Category Archive Pages.php
<?php
$term = get_queried_object();
// gets the term object for the current Wordpress category
// more info http://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/
$acf_term = $term->taxonomy . "_" . $term->term_id;
?>
@omurphy27
omurphy27 / Using modernizr to detect support for the CSS Calc() property.js
Last active August 29, 2015 14:20
Using modernizr to detect support for the CSS Calc() property
// Using modernizr to detect support for the CSS Calc() property
// Especially useful because older phone browsers don't support Calc()
// source http://stackoverflow.com/questions/18359506/using-modernizr-to-test-browser-support-for-css-calc
// use and include special modernizr build: http://modernizr.com/download/#-shiv-cssclasses-prefixes-css_calc-load
supportsCalc();
function supportsCalc() {
@omurphy27
omurphy27 / Show bootstrap modal window only once onload via JS Cookie.html
Last active May 22, 2019 16:27
Show bootstrap modal window only once onload via JS Cookie.js
@omurphy27
omurphy27 / quick and dirty jquery parallax effect using waypoints.js
Created April 28, 2015 21:22
quick and dirty jquery parallax effect using waypoints.js
// quick and dirty jquery parallax effect using waypoints
$(window).on('scroll',function() {
var $strawberries = $('.strawberries'),
$strawberry2 = $('.strawberries img:nth-child(2)'),
$strawberry3 = $('.strawberries img:last-child'),
$circle3 = $('.circles-container .circle:nth-child(3n)'),
$circle4 = $('.circles-container .circle:nth-child(4n)'),
$circle5 = $('.circles-container .circle:nth-child(5n)'),
$fallingOrange = $('.forange'),
@omurphy27
omurphy27 / woocommerce - wordpress - remove breadcrumbs only from the main front shop page.php
Created April 23, 2015 21:52
woocommerce - wordpress - remove breadcrumbs only from the main front shop page.php
// woocommerce - remove breadcrumbs only from the main front shop page
add_action( 'woocommerce_before_main_content', 'jk_remove_wc_breadcrumbs' );
function jk_remove_wc_breadcrumbs() {
if (is_shop()) {
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
}
}
@omurphy27
omurphy27 / gist:e940b80ac97c6cf30ba9
Created April 21, 2015 18:58
Jquery - create element with append and custom CSS on the fly.js
// credit: http://stackoverflow.com/questions/12143106/create-element-in-jquery
$("<div/>",{
"class" : "circle " + $color,
// .. you can go on and add properties
"css" : {
"width" : $width,
"height" : $width,
"left" : $left,
"top" : $top
@omurphy27
omurphy27 / PHP checking if a variable is not equal to multiple conditions.php
Created April 17, 2015 05:18
PHP checking if a variable is not equal to multiple conditions.php
<?php
// see here
// http://stackoverflow.com/questions/19949923/simpler-way-to-check-if-variable-is-not-equal-to-multiple-string-values
// php checking if a variable is not equal
// to multiple conditions
if ( !in_array($some_variable, array('uk','in'), true ) ) {
@omurphy27
omurphy27 / Wordpress - Move All JS scripts to the footer.php
Created March 31, 2015 21:43
Wordpress - Move All JS scripts to the footer.php
@omurphy27
omurphy27 / WooCommerce - Change Wrapping Markup through Main Content Action Hook.php
Last active September 10, 2022 04:21
WooCommerce - Change Wrapping Markup through Main Content Action Hook.php
<?php
// add core markup to woocommerce pages
add_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper');
// overwrite existing output content wrapper function
function woocommerce_output_content_wrapper() {
echo '<div class="main-bg no-top-banner">
<div class="container">
<div id="content" class="row" >
<div id="main" class="col-md-9 pull-right clearfix" >';
@omurphy27
omurphy27 / Advanced Custom Fields ACF Basic Repeater Code Example.php
Created February 18, 2015 19:24
Advanced Custom Fields ACF Basic Repeater Code Example.php
<?php
if( have_rows('repeater_field_name') ):
while ( have_rows('repeater_field_name') ) : the_row();
the_sub_field('sub_field_name');
endwhile;