Skip to content

Instantly share code, notes, and snippets.

View jamigibbs's full-sized avatar

Jami Gibbs jamigibbs

View GitHub Profile
<?php // image gallery content
if( has_shortcode( $post->post_content, 'gallery' ) ) {
// Grab the first gallery in the post
$gallery = get_post_gallery_images( $post->ID );
$image_list = '<div class="owl-carousel">';
// Loop through each image in each gallery
foreach( $gallery as $image ) {
@justintadlock
justintadlock / customize-control-radio-image.php
Last active September 5, 2018 17:14
Customize Control: Radio Image
<?php
/**
* The radio image customize control extends the WP_Customize_Control class. This class allows
* developers to create a list of image radio inputs.
*
* Note, the `$choices` array is slightly different than normal and should be in the form of
* `array(
* $value => array( 'url' => $image_url, 'label' => $text_label ),
* $value => array( 'url' => $image_url, 'label' => $text_label ),
* )`
@westonruter
westonruter / WidgetWithBehaviorScript.widget.php
Created May 6, 2010 22:08
WidgetWithBehaviorScript: Template for a WordPress widget which enqueues an accompanying behavior script; script only output if widget is rendered.
<?php
class WidgetWithBehaviorScript extends WP_Widget {
function __construct() {
parent::__construct(__CLASS__, 'Widget with Accompanying Behavior Script', array(
'classname' => __CLASS__,
'description' => "This WordPress widget serves as a pattern for how to enqueue a script only if the widget is actually rendered."
));