This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* -------------------------------------------------------------------------------// | |
* wrap video's with Zurb Foundation flex-video class div | |
* @author @david | |
* -------------------------------------------------------------------------------// | |
*/ | |
add_filter('embed_oembed_html', 'david_embed_oembed_html', 99, 4); | |
function david_embed_oembed_html($html, $url, $attr, $post_id) { | |
return '<div class="flex-video widescreen">' . $html . '</div>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 ); | |
add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 ); | |
function remove_width_attribute( $html ) { | |
$html = preg_replace( '/(width|height)="\d*"\s/', "", $html ); | |
return $html; | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1><?php //single_cat_title() ?></h1> | |
<?php //echo str_replace('Categorie: ','',get_the_archive_title()); ?> | |
<?php //echo '<h1 class="page-title">' . single_cat_title( '', false ) . '</h1>'; ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function alter_comment_form_fields($fields){ | |
//$fields['author'] = ''; //removes name field | |
//$fields['email'] = ''; //removes email field | |
//$fields['url'] = ''; //removes website field | |
return $fields; | |
} | |
add_filter('comment_form_default_fields','alter_comment_form_fields'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE wp_options SET option_value = replace(option_value, 'http://www.alpha-audio.nl', 'http://www.alpha-audio.dev') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, 'http://www.alpha-audio.nl','http://www.alpha-audio.dev'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.alpha-audio.nl', 'http://www.alpha-audio.dev'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.alpha-audio.nl','http://www.alpha-audio.dev'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//reflow after page load | |
$(document).foundation('accordion', 'reflow'); | |
//animate open/close | |
$(".accordion li").on("click", "a:eq(0)", function (event) { | |
var dd_parent = $(this).parent(); | |
if(dd_parent.hasClass('active')) { | |
$(".accordion li ul.content:visible").slideToggle("normal"); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* generate featured image automatically | |
* @author @david <[email protected]> | |
*/ | |
function autogen_featured_img() { | |
global $post; | |
if (!has_post_thumbnail($post->ID)) { | |
$attached_image = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class to return multiple RSS feeds in WordPress | |
* Instructions: | |
* 1. Upload this class to theme folder | |
* 2. Include this class in functions.php ie: include "mytheme/wow_rss.php"; | |
* | |
* In theme template: | |
* 3. Create new object of class ie: $obj = new wow_Rss ("http://www.mywebsite.co.uk/feed","5"); | |
* Enter feed url as 1st argument and how many items from that feed as the 2nd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# find the children (subpages) of a parent page, in this case the "about" page #} | |
<ul> | |
{% for p in page.find('/about').children if p != page %} | |
<li><a href="{{p.url}}">{{ p.title }}</a></li> | |
{% endfor %} | |
</ul> | |
{# show all the pages with a certain category, in this case "cars" #} | |
<h2>All the CAR posts</h2> | |
<ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @david: add or remove classes at certain scrolling distances | |
// the class names in this gist are meant as an example :-) | |
$(window).scroll(function() { | |
var y_scroll_pos = window.pageYOffset; | |
var scroll_pos_test = 300; | |
// set to whatever you want it to be | |
if (y_scroll_pos > scroll_pos_test) { | |
$(".menu").addClass("animated fadeInLeft"); | |
// or add or remove pure CSS code: |