Skip to content

Instantly share code, notes, and snippets.

View media317's full-sized avatar

Alan Smith media317

View GitHub Profile
@media317
media317 / copyboard instantiate script
Created March 8, 2017 16:26
activate the script for the post or page
<script type="text/javascript">
var clipboard = new Clipboard('.btn');
</script>
@media317
media317 / clipboard HTML
Created March 8, 2017 16:21
HTML structure for clipboard.js
<div id="clipboard">
<p>Your Text to be copied</p>
</div>
<button class="btn" data-clipborad-action="copy" data-clipboard-target="#clipboard">Copy to Clipboard</button>
</div>
@media317
media317 / clipboard enqueue
Created March 8, 2017 16:14
Code to enqueue clipboard.js to WordPress functions.php
//* Enqueue Scripts
add_action( 'wp_enqueue_scripts', 'load_responsive_javascript' );
function load_responsive_javascript() {
wp_enqueue_script( 'clipboard', get_stylesheet_directory_uri() . '/js/clipboard.js', array( 'jquery' ), '1.0.0' );
}
@media317
media317 / FAQ toggle HTML
Created March 8, 2017 03:55
FAQ Toggle HTML
<ul class="faq-list">
<li><a href="#" class="question">Question One</a>
<div class="answer">
<p>Answer to Question One.</p>
</div>
</li>
<li><a href="#" class="question">Question Two</a>
<div class="answer">
<p>Answer to Question Two.</p>
</div>
@media317
media317 / FAQ toggle css
Created March 8, 2017 03:50
FAQ toggle CSS
/* # FAQ
--------------------------------------------- */
.entry-content .faq-list,
.entry-content .faq-list li {
list-style: none;
margin: 0;
padding: 0;
}
@media317
media317 / FAQ Toggle Enqueue
Last active March 8, 2017 03:51
FAW Enqueue script in functions.php of WordPress
//* Enqueue Scripts
add_action( 'wp_enqueue_scripts', 'load_toggle_javascript' );
function load_toggle_javascript() {
wp_enqueue_style( 'dashicons' );
wp_enqueue_script( 'toggle', get_stylesheet_directory_uri() . '/js/toggle.js', array( 'jquery' ), '1.0.0' );
}
@media317
media317 / FAQ Toggle js
Created March 8, 2017 03:47
FAQ Toggle javascript of question and answer
jQuery(function( $ ){
$('.faq-list .question').click( function(){
$(this).parent().find('.answer').slideToggle('fast');
$(this).toggleClass('on');
return false;
});
});
<?php
/**
* The template used for displaying page content in page.php
*
* @package AppPresser Theme
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@media317
media317 / category loop
Last active August 29, 2015 14:08
Attempting to create a WordPress Loop that pulls the category slug from the custom field value of key cbc_category. The loop will pull all post with the category in the value of the custom field and display the featured image, title and excerpt.
// Add our custom loop
add_action( 'genesis_after_entry_content', 'media317_cat_loop' );
function media317_cat_loop() {
$cbccategory = genesis_get_custom_field('cbc_category');
$args = array(
'category_name' => $cbccategory,
'orderby' => 'post_date',
// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com