Skip to content

Instantly share code, notes, and snippets.

View yumyo's full-sized avatar

Giulia Nicole Pernice yumyo

View GitHub Profile
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
<?php
/**
* This code is intended to be added to your wp-config.php file just below the top comment block.
* It should replace the existing define('DB_*') statements. You can add or remove sections
* depending on the number of environments you intend to setup. You should change all values of
* DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST for each environment, making them all distinct
* for security purposes.
*/
// determine the current environment
add_filter( 'walker_nav_menu_start_el', 'gt_add_menu_item_description', 10, 4);
function gt_add_menu_item_description( $item_output, $item, $depth, $args ) {
$desc = __( $item->post_content );
return preg_replace('/(<a.*?>[^<]*?)</', '$1' . "<small class=\"nav-desc\">{$desc}</small><", $item_output);
}
// expand {{PATTERNS}}
// You can do this serverside. I just did it this way for demonstration purposes.
(function () {
"use strict";
var shares = document.querySelectorAll("ul.share > li > a");
var keywords = document.querySelector('meta[name=keywords]').getAttribute("content");
var description = document.querySelector('meta[name=description]').getAttribute("content");
var params = {
URL: encodeURIComponent(document.querySelector('link[rel=canonical]').getAttribute("href")),
@yumyo
yumyo / clean-walker.php
Created October 27, 2015 15:15 — forked from hereswhatidid/clean-walker.php
WordPress nav walker that strips the WP generated styles and IDs from the generated output.
<?php
class Clean_Walker_Nav extends Walker_Nav_Menu {
/**
* Filter used to remove built in WordPress-generated classes
* @param mixed $var The array item to verify
* @return boolean Whether or not the item matches the filter
*/
function filter_builtin_classes( $var ) {
return ( FALSE === strpos( $var, 'item' ) ) ? $var : '';
}
/**
* Place this code in your theme's functions.php file to make the HTML
* it produces is more BEM friendly.
* This works out the menu_class value from wp_nav_menu() and uses that to create
* the class values.
*/
// Add a class to wp_nav_menu <li> tags so you get <li class="{menu_class}_item">
add_filter('nav_menu_css_class' , 'my_nav_special_class' , 10 , 3);
function my_nav_special_class($classes, $item, $args){
@yumyo
yumyo / visor-archivos-online.md
Created April 20, 2016 15:46 — forked from izazueta/visor-archivos-online.md
Google Docs Viewer & Office Web Apps Viewer

Google Docs Viewer

Only files under 25 MB can be previewed with the Google Drive viewer.

Google Drive viewer helps you preview over 16 different file types, listed below:

  • Image files (.JPEG, .PNG, .GIF, .TIFF, .BMP)
  • Video files (WebM, .MPEG4, .3GPP, .MOV, .AVI, .MPEGPS, .WMV, .FLV)
  • Text files (.TXT)
  • Markup/Code (.CSS, .HTML, .PHP, .C, .CPP, .H, .HPP, .JS)
  • Microsoft Word (.DOC and .DOCX)
@yumyo
yumyo / responsive.photoset.wp.func.php
Created May 6, 2016 14:40 — forked from terrymun/responsive.photoset.wp.func.php
Responsive Photoset — WordPress function
// Declare "custom_photoset" function
function custom_photoset($attr) {
$args = shortcode_atts(
array(
'ids' => '',
'layout' => ''
),
$attr,
'photoset'
);
@yumyo
yumyo / table_alignment.css
Created July 15, 2016 08:30 — forked from danielpietzsch/table_alignment.css
How to align a HTML table inside a div
/* Align a table right inside a div element */
/* Adjust accordingly for centering the table */
div.contains_table {
text-align: right;
}
div.contains_table table {
margin-right: 0;
margin-left: auto;
}