Skip to content

Instantly share code, notes, and snippets.

View yumyo's full-sized avatar

Giulia Nicole Pernice yumyo

View GitHub Profile
@yumyo
yumyo / WP SVG svgstore Menu Icons + .png fallback
Last active January 6, 2016 15:17
A quick function to add svgstore icons to WordPress menu items. Just make sure your item class match the symbol definition. Use Modernizr and Css to get a png fallback
add_filter( 'walker_nav_menu_start_el', 'kk_add_menu_item_icon', 10, 4);
function kk_add_menu_item_icon( $item_output, $item, $depth, $args ) {
$icon_name = $item->classes[0];
return preg_replace('/(<a.*?>[^<]*?)</', '$1' . "<svg class=\"icon icon--{$icon_name} icon--svg\"><use xlink:href=\"#symbol-{$icon_name}\" /></svg><span class=\"icon icon--{$icon_name} icon--png\"></span><", $item_output);
}
@yumyo
yumyo / base.php
Last active January 11, 2016 16:39
WordPress FEATURE BASED ROUTING - Example based on Sage but could be extended / adapted to any WP or HTML theme
<body <?php body_class(); ?> data-features="<?php echo Roots\Sage\Extras\get_feature(); ?>">
@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)
homeSwiper.on('onReachEnd', function(){
setTimeout(function(){
homeSwiper.lockSwipes();
homeSwiper.disableMousewheelControl();
window.scrollBy(0, 1);
}, 800);
});
@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'
);
<?php $args = array(
'posts_per_page' => 5,
'offset' => 0,
'category' => '',
'category_name' => '',
'orderby' => 'date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
@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;
}
@yumyo
yumyo / _mixins-horizontal_table_list.scss
Last active July 18, 2016 14:35 — forked from joelstein/_mixins.scss
Horizontal list mixins
// Standard horizontal list, using word-spacing trick to remove whitespace
// between inline-block elements.
@mixin horizontal-list {
padding: 0;
text-align: center;
word-spacing: -1em;
display: table;
width: 100%;
li {
/**
* Load different template for sub category
*/
function sub_category_template() {
// Get the category id from global query variables
$cat = get_query_var('cat');
if(!empty($cat)) {
@yumyo
yumyo / movegfjstofooter.php
Created July 25, 2016 14:49 — forked from eriteric/movegfjstofooter.php
Load gravity forms JS in footer
// GF method: http://www.gravityhelp.com/documentation/gravity-forms/extending-gravity-forms/hooks/filters/gform_init_scripts_footer/
add_filter( 'gform_init_scripts_footer', '__return_true' );
// solution to move remaining JS from https://bjornjohansen.no/load-gravity-forms-js-in-footer
add_filter( 'gform_cdata_open', 'wrap_gform_cdata_open' );
function wrap_gform_cdata_open( $content = '' ) {
$content = 'document.addEventListener( "DOMContentLoaded", function() { ';
return $content;
}
add_filter( 'gform_cdata_close', 'wrap_gform_cdata_close' );