Skip to content

Instantly share code, notes, and snippets.

@stevenslack
stevenslack / class-drop-walker-nav.php
Last active November 24, 2020 07:53
WordPress Walker Nav extended to add data attributes for Drop support
<?php
/**
* Extends WordPress nav menu by adding data attributes and
* markup for Drop by Chris Ferdinandi
*
* Version 6.1.1
*
* drop source: https://github.com/cferdinandi/drop
*/
@srikat
srikat / equalheights-init.js
Last active February 8, 2017 00:40
Equal height elements in WordPress using jQuery.equalHeights. http://sridharkatakam.com/equal-height-elements-wordpress-using-jquery-equalheights/
jQuery(document).ready(function($) {
$(window).load(function() {
if (window.innerWidth > 1024) {
$('.footer-widgets .widget-area').equalHeights();
}
});
$(window).resize(function(){
if (window.innerWidth > 1024) {
@xadhix-zz
xadhix-zz / Facebook Lookback Downloader
Created February 4, 2014 12:18
Extracts the HD video link from the Facebook lookback page.
var xLBD = {};
xLBD.c = function (){
xLBD.f = unescape(document.querySelector("[flashvars]").getAttribute("flashvars")).substring(7);
xLBD.f = JSON.parse(xLBD.f.substring(0, xLBD.f.lastIndexOf("}") + 1)).video_data[0].hd_src;
xLBD.a = "<div style='position:absolute;top:100px;height:300px;left:15%;background:#fff;border:10px solid #000;font-size:5em;padding:100px;'>Click <a download='lookback.mp4' href='"+xLBD.f+"'>here<\/a> to download your lookBack video.</div>";
document.body.innerHTML += xLBD.a;
}
if(document.readyState == "complete")
xLBD.c();
else window.onload = xLBD.c;
<?php
/**
* Grid Content
* Change the number of words in excerpt if in the grid loop
*/
function be_grid_content() {
// First, we make sure we're in the grid loop.
if( ! apply_filters( 'is_genesis_grid_loop', false ) )
return;
@tammyhart
tammyhart / responsive-iframes.js
Last active August 19, 2018 11:10
Make iframes responsive by calculating the correct aspect ratio and filling to the width of the container as it flexes.
// iframes
var $iframes = $( document.querySelectorAll( '.videos iframe' ) );
function iframeSizing() {
var $this = $( this ),
width = $this.width(),
height = $this.height(),
containerWidth = $this.parent().width(),
heightRatio = height / width,
newHeight = heightRatio * containerWidth;
<?php
$argsSamaj = array( 'post_type' => 'videos_gallery','cat'=>$on_draught,'posts_per_page' => 10);
$loopSamaj = new WP_Query( $argsSamaj );
if( $loopSamaj->have_posts() ):
echo '<ul>';
while( $loopSamaj->have_posts() ): $loop->the_post();
echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
endwhile;
echo '</ul>';
@omurphy27
omurphy27 / transparent background image pattern overlay.css
Created March 26, 2013 04:59
CSS Transparent Background Image Pattern Overlay
/*Transparent pattern placed over an image, like we see on the bootstrap homepage: http://twitter.github.com/bootstrap/index.html*/
div {
width: 200px;
height: 200px;
display: block;
position: relative;
background: url(images/background-image.png);
}
@BFTrick
BFTrick / sql-command.sql
Last active April 25, 2022 14:31
A SQL command to delete all orphaned post meta data
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
@norcross
norcross / gist-shortcode.php
Last active December 12, 2015 08:08
embed Gist shortcode
<?php
// usage: get the gist ID and place the shortcode in the site: [gist id="THE_ID"]
// allows for an optional title to display above, i.e [gist id="THE_ID" title="Some Title"]
// embed gists
function gist_shortcode($atts, $content = NULL) {
extract( shortcode_atts( array(
'id' => '',
'user' => 'norcross',
'title' => ''
@trepmal
trepmal / faster-archive-links.php
Created January 26, 2013 22:16
Makes it easy to add custom post type archive links to a custom menu