Skip to content

Instantly share code, notes, and snippets.

@mhulse
mhulse / section.php
Created February 25, 2012 00:05
Pagelines 2.1.1, Base Theme 1.0.2 and Wordpress 3.3.1: PageLines section a header with blog name/title and logo...
<?php
/*
Section: Brand & Flag
Author: Micky Hulse
Author URI: http://www.registerguard.com
Description: Shows full width branding and flag.
Class Name: BrandAndFlag
Workswith: header
*/
@norcross
norcross / rkv_date_convert
Created April 1, 2012 17:20
Convert date entry to UNIX timestamp
// Make two admin-only fields (as text fields)
// and post to the custom fields from Gravity Forms
// instead of the "real" date picker.
// NOTE: change the input IDs to match the ones on your form
function rkv_datesubmit_fix ($form){
//event start date field id is 3
//event end date field ID is 4
$raw_srt = $_POST['input_3'];
$raw_end = $_POST['input_4'];
@tvandervossen
tvandervossen / environment.js
Last active April 2, 2024 20:18
Here’s an example of my current web app user agent, device, and/or feature detection approach. I tend to inline this in the page header just before the stylesheet as part of the distribution build. A benefit of this approach is that detection is done early without any external dependencies. It’s also straightforward to modify or extend while you…
env = (function() {
var flags = {}, ua = navigator.userAgent, el = document.createElement('div'), video = document.createElement('video'), audio = document.createElement('audio'), root = document.documentElement, i
function flag(names) {
names = names.split(' ')
for (i = 0; i < names.length; i++)
flags[names[i]] = true
}
function classnames() {
var names = [], name
for(name in flags) if (flags.hasOwnProperty(name))
@dk8996
dk8996 / navbar-div.html
Last active December 16, 2015 14:38
Blog post about Bootstrap and social icons in the navbar.
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse"
data-target=".nav-collapse">
<span class="icon-bar"></span> <span class="icon-bar"></span> <span
class="icon-bar"></span>
</button>
<a class="brand" href="#">{de-encode}</a>
<div class="nav-collapse collapse">
@charleslouis
charleslouis / custom-search-acf-wordpress.php
Last active December 15, 2023 09:11
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request
<?php
/**
* [list_searcheable_acf list all the custom fields we want to include in our search query]
* @return [array] [list of custom fields]
*/
function list_searcheable_acf(){
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
return $list_searcheable_acf;
}
@bloqhead
bloqhead / acf_date_formatter.php
Last active December 25, 2015 05:29
This takes your ACF datepicker field and formats it as d/m/Y.
<?php
/**
* Custom ACF Date Format
* Usage: bsd_date('custom_date_picker_field_name_here')
* Only to be used with the datepicker field type!
*/
function bsd_date( $value ) {
$bsd_date = get_field( $value );
if( $bsd_date ) {
@DevinWalker
DevinWalker / gravity-forms_bootstrap
Last active November 28, 2023 20:35
Gravity Forms Twitter Bootstrap CSS Styles Turn OFF Gravity Forms CSS Turn On HTML5 See: http://roots.io/style-gravity-forms-with-bootstrap/
/* ------------------------------------
Gravity Forms
---------------------------------------*/
.gform_wrapper ul { padding-left: 0; list-style: none }
.gform_wrapper li { margin-bottom: 15px }
.gform_wrapper form { margin-bottom: 0 }
@theukedge
theukedge / gist:7456141
Last active June 11, 2016 09:50
Stop posts from showing up multiple times on the same page.
<div id="top-featured" class="clearfix home-block">
<?php
$do_not_duplicate = array();
$my_query = new WP_Query( array(
'post_type' => 'features',
'posts_per_page' => 1
) );
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="above-post">
@ahansson89
ahansson89 / gist:7574653
Created November 21, 2013 01:41
Add a Font Awesome icons select to CPT meta by humanmade: https://github.com/humanmade/Custom-Meta-Boxes/
class ah_is_awesome {
function __construct() {
if(! class_exists( 'CMB_Meta_Box' ) ) {
require_once( 'includes/custom-meta/custom-meta-boxes.php' );
}
}
@Pross
Pross / gist:7682426
Created November 27, 2013 20:10
Show PageLines plugins at a glance.
add_filter( 'views_plugins', 'my_views' );
function my_views( $views ) {
$views['pl'] = "<a href='plugins.php?s=pagelines' >PageLines<a>";
return $views;
}