Skip to content

Instantly share code, notes, and snippets.

View iamgaby7521's full-sized avatar

Gabriela F. iamgaby7521

View GitHub Profile
@iamgaby7521
iamgaby7521 / jquery-boilerplate.js
Last active October 7, 2017 02:43 — forked from tommcfarlin/jquery-boilerplate.js
How to properly add jQuery scripts to WordPress
// Loading scripts in footer
(function($) {
"use strict";
// example for document ready
$(document).ready(function() {
// Your code here
});
}(jQuery));
@iamgaby7521
iamgaby7521 / random-class.js
Last active May 2, 2020 19:12
add random classes - js
(function($){
$(document).ready(function() {
var classes = [ 'style1', 'style2', 'style3' ]; // the classes you want to add
$('.item').each(function(i) { // the element(s) you want to add the class to.
$(this).addClass(classes[ Math.floor( Math.random()*classes.length ) ] );
});
});
})(jQuery);
@iamgaby7521
iamgaby7521 / wp-custom-excerpt.php
Created January 15, 2015 19:25
WP Custom Excerpt
<?php
// You can add this in your function.php file to modify the Wordpress Excerpt
if ( !function_exists( 'theme_excerpt_length' ) ) :
function theme_excerpt_length( $length ) {
return 40;
}
endif;
if ( !function_exists( 'theme_excerpt_more' ) ) :
function theme_excerpt_more( $more ) {
@iamgaby7521
iamgaby7521 / get_page_link.php
Last active October 8, 2020 22:10
Get page link by template (only gets the first page from the array)
@iamgaby7521
iamgaby7521 / z-index.scss
Last active October 8, 2020 21:54 — forked from fat/gist:1f6da6b3bd0311a1f8a0
z-index scale
// Copyright 2014 A Medium Corporation
//
// z-index.less
// Medium.com's z-index scale. Z-index values should always be defined in z-index.less. This
// allows us to at a glance determine relative layers of our application and prevents bugs
// arrising from arbitrary z-index values. Do not edit the z-index scale! Only add application
// scoped z-index values.
// Z-Index Scale (private vars)
@iamgaby7521
iamgaby7521 / sublime-text-remove-comments-css
Created July 7, 2018 02:56 — forked from schalkburger/sublime-text-remove-comments-css
Sublime Text regex to remove comments in CSS
(?s)/\*.*?\*/
@iamgaby7521
iamgaby7521 / schema-org-structured-data-markup-using-microdata.html
Last active February 16, 2019 23:12 — forked from milanaryal/schema-org-structured-data-markup-using-microdata.html
An example of how to mark up a HTML5 webpage using the schema.org schemas and microdata.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Site Title</title>
<link rel="stylesheet" href="/assets/css/style.min.css">
@iamgaby7521
iamgaby7521 / functions.php
Last active December 14, 2020 19:51
Disable notices in WordPress dashboard
<?php
/**
* Disable admin notices for all.
*/
function _action_disable_admin_notices() {
global $wp_filter;
@iamgaby7521
iamgaby7521 / gist:e58ed97d8e4b8776150c57730facf77a
Created October 8, 2020 22:11 — forked from fat/gist:3744369
all you probably really need
/*! normalize-all-you-really-need-tho.css v1.0.0 | MIT License */
html {
font-family: sans-serif; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
-ms-text-size-adjust: 100%; /* 2 */
}
body {
margin: 0;
@iamgaby7521
iamgaby7521 / functions.php
Last active December 14, 2020 19:51
Hide admin bar for WP
<?php
/**
* Hide admin bar
*/
// show admin bar only for admins
if ( ! current_user_can( 'manage_options' ) ) {
add_filter( 'show_admin_bar', '__return_false' );
}