Skip to content

Instantly share code, notes, and snippets.

View yumyo's full-sized avatar

Giulia Nicole Pernice yumyo

View GitHub Profile
@yumyo
yumyo / schema-wp-extend-output.php
Created January 19, 2017 16:37 — forked from schemapress/schema-wp-extend-output.php
Extend / Override Schema.org JSON_LD Output in WordPress Schema Plugin http://schema.press
<?php //* do not include php tag
add_filter('schema_output', 'schema_wp_extend_output_987345256');
/**
* Extend / Override Schema Output
*
* @since 1.0
*/
function schema_wp_extend_output_987345256( $schema ) {
@yumyo
yumyo / functions.php
Created January 15, 2017 16:12 — forked from wpscholar/functions.php
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
@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' );
/**
* 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 / _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 {
@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 / 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 / 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)
/**
* 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){