Skip to content

Instantly share code, notes, and snippets.

View sta1r's full-sized avatar

Alastair Mucklow sta1r

  • Dotdigital
  • Winchester
View GitHub Profile
@sta1r
sta1r / gist:5619605
Created May 21, 2013 13:03
Pro method to set up Wordpress styles and scripts
/**
* Enqueue scripts and styles
*/
function the_general_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
@sta1r
sta1r / gist:5628081
Last active December 17, 2015 14:59
Box-out redux
<div class="row buffer-top-plus">
<div class="d5-d16 bg-gray-bg box-out-con">
<div class="row">
<div class="d5-d8">
<figure class="box-out pull-right">
<img src="{{ site.url }}assets/img/placeholders/profile.jpg" alt="" class="d-all" style="margin-bottom:12px;">
<figcaption style="line-height:20px;">The current vice-chancellor is Nigel Carrington, who took up the role in September 2008.</figcaption>
</figure>
</div>
<div class="d9-d16">
@sta1r
sta1r / gist:5765210
Created June 12, 2013 13:25
Conditional logic in Site Manager
<?php
// PHP is useful for conditional logic where the HTML structure is very different - e.g.
$number_of_highlight_boxes = '<t4 type="content" name="Number of boxes" output="normal" modifiers="" />';
if ($number_of_highlight_boxes == "1") { /* write some HTML */ } else { /* write some more HTML */ }
?>
<!--
@sta1r
sta1r / gist:5804927
Last active December 18, 2015 15:29
LCF Live Stream / Video on Demand
<!-- Live stream -->
<iframe src='http://live.3xscreen.com/lcf/embed/' width='640' height='360' frameborder='0'></iframe>
@sta1r
sta1r / gist:5822000
Last active December 18, 2015 17:59
Image Block
<div class="content-wrapper">
<div class="main-content">
<div class="row">
<div class="image-block">
<h2>Image block with optional title</h2>
<figure>
<img src="http://placehold.it/1000x500&text=IMAGE, VIDEO OR SLIDER" alt="Image Alt">
<figcaption>
<p>This is a information for the image above, it can be either accreditation or a caption. This should not run more then 2 lines. (optional)</p>
</figcaption>
@sta1r
sta1r / UAL Beta Gemfile
Created July 22, 2013 16:37
UAL Beta - Gemfile and Guardfile
# Why use bundler?
# Well, not all development dependencies install on all rubies. Moreover, `gem
# install sinatra --development` doesn't work, as it will also try to install
# development dependencies of our dependencies, and those are not conflict free.
# So, here we are, `bundle install`.
#
# If you have issues with a gem: `bundle install --without-coffee-script`.
source 'https://rubygems.org'
@sta1r
sta1r / UAL: Whitespace component
Created July 23, 2013 12:57
UAL: Whitespace component
/* There's nothing here */
@sta1r
sta1r / video-block.php
Created August 12, 2013 14:27
Video in Block Class
<?php if ($media_type == 'video') { ?>
<video src="<t4 type="content" name="Media" output="normal" modifiers="" formatter="image/path" />" style="width:100%;height:100%;" controls="control" preload="none">
<?php if ($video_url != '') { ?>
<source src="<?php echo $video_url; ?>" type="video/youtube" />
<?php } ?>
</video>
<?php } else { ?>
@sta1r
sta1r / AZ Class
Created August 23, 2013 14:05
.. with array and initialization.
<!-- A-Z Class -->
<?php
// check whether class exists
if(class_exists('AZ') != true)
{
class AZ {
public $array; // profiles content array
@sta1r
sta1r / text-slash-grid
Last active December 22, 2015 08:59
Grid formatter - for Publish to One File Navigation element that scans a section's children.
<?php
// formatter for displaying list children at a parent level, in a content grid
if (!isset($old_section_title)) { $old_section_title = ''; }
$media_path = '';
$thumbnail_media_path = "<t4 type="content" name="Optional Thumbnail" output="normal" modifiers="" formatter="image/path" />";
$current_section_title = "<t4 type="navigation" id="49"/>";
$image_or_video = "<t4 type="content" name="Image or video?" output="normal" modifiers="" />";
// this conditional prevents the list from pulling back more than the first media block instance in a child section
if ($current_section_title != $old_section_title) {