Skip to content

Instantly share code, notes, and snippets.

John Sanabria Sanabria

Block or report user

Report or block Sanabria

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View custom-excerpt.php
function custom_read_more() {
return '... <a class="read-more" href="'.get_permalink(get_the_ID()).'">more&nbsp;&raquo;</a>';
}
function excerpt($limit) {
return wp_trim_words(get_the_excerpt(), $limit, custom_read_more());
}
View gist:f9215385d190762dc72607b032d23873
add one line alias into your .bash_profile, then you are done:
alias subl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'
use:
subl [YOUR_FILE_PATH_TO_OPEN]
@Sanabria
Sanabria / fade.js
Created Jan 16, 2019 — forked from alirezas/fade.js
fadeIn & fadeOut in vanilla js
View fade.js
function fadeOut(el){
el.style.opacity = 1;
(function fade() {
if ((el.style.opacity -= .1) < 0) {
el.style.display = "none";
} else {
requestAnimationFrame(fade);
}
})();
@Sanabria
Sanabria / .gitignore
Created Oct 29, 2018 — forked from salcode/.gitignore
Please see https://salferrarello.com/wordpress-gitignore/ for the canonical version of this WordPress .gitignore file. Note: I do not receive notifications for comments here (because GitHub does not send notifications on Gists)
View .gitignore
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20180808
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@Sanabria
Sanabria / Blade Version
Created Aug 1, 2018
Get Excerpt from an Advanced Custom Field ACF
View Blade Version
function custom_field_excerpt($text, $words) {
global $post;
//$text = get_field('your_field_name'); //Replace 'your_field_name'
if ( '' != $text ) {
$text = strip_shortcodes( $text );
$text = apply_filters('the_content', $text);
$text = str_replace(']]&gt;', ']]&gt;', $text);
$excerpt_length = $words; // 20 words
$excerpt_more = apply_filters('excerpt_more', ' foobar' . '[...]');
$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
View Bulma Tabs Walker
/**
* Bulma Tabs Walker Subnav
*/
add_filter('nav_menu_css_class' , __NAMESPACE__ .'\special_nav_class' , 10 , 2);
function special_nav_class($classes, $item){
if( in_array('current-menu-item', $classes) ){
$classes[] = 'is-active ';
}
return $classes;
}
@Sanabria
Sanabria / filters.php
Created Jun 11, 2018
include ACF into Sage 9
View filters.php
/**
* Customize ACF path
*/
add_filter('acf/settings/path', function ( $path ) {
$path = get_stylesheet_directory() . '/../vendor/advanced-custom-fields/advanced-custom-fields-pro/';
return $path;
});
@Sanabria
Sanabria / fix-wordpress-permissions.sh
Last active Apr 21, 2018 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
View fix-wordpress-permissions.sh
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
# Source for this script: http://www.conigliaro.org/script-to-configure-proper-wordpress-permissions/
#
# To use this script, supply the full path to your wordpress directory
@Sanabria
Sanabria / ChangeLabelWooCheckout.php
Created Dec 20, 2017 — forked from tavomak/ChangeLabelWooCheckout.php
Cambiar Los encabezados del checkout de woocommerce
View ChangeLabelWooCheckout.php
//Detalles de facturación
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Detalles de facturación' :
$translated_text = __( 'Nuevo Encabezado', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
@Sanabria
Sanabria / creative-cloud-disable.md
Created Dec 7, 2017 — forked from andreibosco/creative-cloud-disable.md
disable creative cloud startup on mac
View creative-cloud-disable.md
You can’t perform that action at this time.