Skip to content

Instantly share code, notes, and snippets.

@badlydrawnben
badlydrawnben / acf-options-page-parent-cpt
Created October 4, 2017 15:48
ACF Options page - pick page parent of a CPT
// Set page parents of Custom Post Types - in the Organisation Setting ACF Options page
// Based upon Joe Sexton's blog post http://www.webtipblog.com/setting-wordpress-custom-post-type-parent-specific-page/
define( 'FRIENDS_PARENT_ID', get_field( 'friends_parent_page', 'option' ) );
add_action( 'wp_insert_post_data', 'biscuit_cpt_parent_page', '99', 2 );
function biscuit_cpt_parent_page( $data, $postarr ) {
global $post;
@badlydrawnben
badlydrawnben / acf-homebuilder-3-mpu.php
Created September 15, 2016 08:44
ACF Extras Page Builder - Views files
<section class="mpu mpu-3 <?php if ($mpu_3_box_css):echo $mpu_3_box_css; endif;?>">
<div class="container">
<div class="row <?php if (!empty($mpu_3_collapse)): echo 'no-gutters'; endif; ?>">
<?php if($mpu_3_title): echo '<h3 class="mpu-title">' . $mpu_3_title . '</h3>'; endif; ?>
<div class="col-md-4 mpu-flex box1">
<div class="mpu-item-wrap">
<?php if ($mpu_3_box_1_title):echo '<h3>' . $mpu_3_box_1_title . '</h3>'; endif;?>
<div class="mpu-item-content-wrap">
<?php $image_att = wp_get_attachment_image_src( $mpu_3_box_1_image, $mpu_3_size ); ?>
<?php if ($mpu_3_box_1_image): echo '<div style="background-image: url( '. $image_att[0] . ')" class="mpu-header-image"></div>'; endif; ?>
@badlydrawnben
badlydrawnben / genesis_gravity_forms_analytics_tracking.php
Last active August 29, 2015 14:24
Gravity Forms - pass donation data to Google Analytics via query string (Genesis version)
<?php
/* This is built upon @jg314's really useful gist here https://gist.github.com/jg314/7591169 I have updated it for Universal Analytics tracking
rather than the older ga.js version*/
// Add this bit to your functions.php file
/*
* Add custom query vars to handle Google Analytics Ecommerce tracking.
* This should be placed in a plugin or in functions.php of the theme.
*
@badlydrawnben
badlydrawnben / gist:d80f2408c9a8b0c7df94
Created July 11, 2015 20:37
Gravity Forms - Charity Donation form example
{"0":{"labelPlacement":"top_label","useCurrentUserAsAuthor":"1","title":"Biscuits Donation Form","descriptionPlacement":"below","button":{"type":"text","text":"Make a Secure Donation"},"fields":[{"type":"section","adminLabel":"","adminOnly":"","allowsPrepopulate":"","defaultValue":"","description":"","content":"","cssClass":"","errorMessage":"","id":"15","inputName":"","isRequired":"","label":"","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":"","displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","ba
@badlydrawnben
badlydrawnben / animated-search
Created October 27, 2014 22:27
For Andreas
@badlydrawnben
badlydrawnben / wp-nav-animated-css
Last active August 29, 2015 14:08
WordPress nav background sliding animation
// Unless you are using a Genesis theme, you will need to change the name of the class selector so it is using the same class names as your existing theme's style sheet'
.genesis-nav-menu > .menu-item > a{
//Paste the CSS code generated by the background gradient generator website
background: -moz-linear-gradient(top, rgba(239,239,239,1) 0%, rgba(239,239,239,1) 50%, rgba(204,204,204,0) 51%, rgba(204,204,204,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(239,239,239,1)), color-stop(50%,rgba(239,239,239,1)), color-stop(51%,rgba(204,204,204,0)), color-stop(100%,rgba(204,204,204,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(239,239,239,1) 0%,rgba(239,239,239,1) 50%,rgba(204,204,204,0) 51%,rgba(204,204,204,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(239,239,239,1) 0%,rgba(239,239,239,1) 50%,rgba(204,204,204,0) 51%,rgba(204,204,204,0) 100%); /* Opera 11.10+ */
background: -ms
<body>
<div class="top_block">
<div class="wrap">
<div class="container">
<div class="row">
<div class="span6 call_now">
<div class="text_wrap1">Mauris adipiscing venenatis volutpat. Pellentesque sit amet lacus non odio gravida hendrerit at et nulla.</div>
</div>
<div class="span6 follow_us">
<ul>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title ><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
@import url('http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300');
@import url('css/prettyPhoto.css');
@import url('css/camera.css');
@import url('css/bootstrap.css');
@import url('css/bootstrap-responsive.css');
@import url('css/tango.css');