Skip to content

Instantly share code, notes, and snippets.

@secretstache
secretstache / get-video-thumbnail.php
Last active Jun 17, 2019
Get Video Thumbnail from Youtube or Vimeo
View get-video-thumbnail.php
<?php
/**
* Retrieves the thumbnail from a youtube or vimeo video
* @param - $src: the url of the "player"
* @return - string
* @todo - do some real world testing.
*
**/
function get_video_thumbnail( $src ) {
View acf-hero-unit.json
[
{
"key": "group_562025a91d355",
"title": "Hero Unit",
"fields": [
{
"key": "field_5620264fa0141",
"label": "Background Media",
"name": "background_media",
"type": "radio",
View acf-options-page-fields.php
<?php
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array (
'key' => 'group_5525dfd96b4a0',
'title' => 'Brand Logo',
'fields' => array (
array (
'key' => 'field_5525dff1be331',
@secretstache
secretstache / data-attributes.php
Created Jul 28, 2016
data attributes for genesis
View data-attributes.php
add_filter( 'genesis_attr_site-container', 'ssm_data_off_canvas_content' );
function ssm_data_off_canvas_content($attributes) {
$attributes['data'] = 'data-off-canvas-content';
return $attributes;
}
// this creates <div class="site-container" data='data-off-canvas-content'></div>
// is there a way to do something like <div class="site-container" data-off-canvas-content></div>
@secretstache
secretstache / gist:9f0a93a9953361edb7bb
Last active Feb 4, 2016
Get First Instance of Visual Editor Content Block
View gist:9f0a93a9953361edb7bb
<?php
/*
* Returns the first instance of a given layout option
* @param - $id - the id of the post you are trying to target: '' by default
* @param - $fc_field - the name of the ACF flexible field: 'content_blocks' as the default
* @param - $fc_layout - the name of the flexible content layout: 'visual_editor' as the default
* @return - mixed
* @todo - test different types of returned content. at the moment, I am only using this for returning a string
*/
function get_first_instance_of_content_block( $id = '', $fc_field = 'content_blocks', $fc_layout = 'visual_editor' ) {
@secretstache
secretstache / gfm.php
Last active Jan 9, 2016
Genesis Markup for Foundation
View gfm.php
<?php
function ssfg_add_markup_class( $attr, $context ) {
// default classes to add
$classes_to_add = apply_filters ('ssfg-classes-to-add',
// default foundation markup values
array(
'site-header' => 'row',
'site-container' => 'inner-wrap',
'site-footer' => 'row',
'content-sidebar-wrap' => 'row',
@secretstache
secretstache / acf-cac.php
Created Apr 8, 2015
Append ACF Post Object to Admin Column Pro Filter Dropdown
View acf-cac.php
<?php
/**
* Filter the Admin Column results
*
*/
function my_cac_filtering_options_change_acf_label( $options, $column ) {
$column_type = 'column-acf_field'; // enter type of field. You can find this by hovering of the Type label of the column settings.
$field_label = 'Product Class'; // enter label of the ACF field.
@secretstache
secretstache / cart66-viewcart.php
Created Apr 8, 2015
Cart 66 Shortcode for View Cart
View cart66-viewcart.php
//Filter Through Store Nav
add_filter( 'wp_nav_menu_items', 'ssm_append_store_navigation', 10, 2 );
function ssm_append_store_navigation ( $items, $args ) {
if ( do_shortcode('[cc_cart_item_count]') == 1 ) {
$cart_item = '<li class="right cart"><a href="' . get_bloginfo('url') . '/view_cart/">' . do_shortcode('[cc_cart_item_count]') . ' Item</a></li>';
} else {
@secretstache
secretstache / layout.php
Created Mar 24, 2015
force content sidebar genesis
View layout.php
//* Force content-sidebar layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
@secretstache
secretstache / acf-soliloquy.php
Created Feb 26, 2015
Dynamic Soliloquy Slideshow using ACF
View acf-soliloquy.php
<?php
add_action( 'genesis_after_header', 'ssm_insert_slideshow', 99 );
/**
* Builds the HTML for the homepage slideshow
*
*/
function ssm_insert_slideshow() { ?>
<?php if ( $slides = get_field( 'slides' ) ) { ?>
You can’t perform that action at this time.