Skip to content

Instantly share code, notes, and snippets.

DarioBF

View GitHub Profile
@DarioBF
DarioBF / script.js
Created Jul 1, 2020
Remove jQuery from WordPress completely
View script.js
/** * Completely Remove jQuery From WordPress */
function my_init() {
if ( ! is_admin() ) {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', false );
}
}
add_action( 'init', 'my_init' );
/** * Completely Remove jQuery From WordPress Admin Dashboard */
add_action( 'wp_enqueue_scripts', 'no_more_jquery' );
View comments-content.php
/**
* Adds comments just before content, nothing between them
*/
add_filter( 'the_content', 'bf_comments_content', 10);
function bf_comments_content( $content) {
if( is_single() && comments_open() ) {
ob_start();
comments_template();
$comments = ob_get_contents();
ob_end_clean();
@DarioBF
DarioBF / whatever.sh
Created Nov 8, 2019
Disable MacOS animations (faster experience)
View whatever.sh
To disable:
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
defaults write -g NSScrollAnimationEnabled -bool false
defaults write -g NSWindowResizeTime -float 0.001
defaults write -g QLPanelAnimationDuration -float 0
defaults write -g NSScrollViewRubberbanding -bool false
defaults write -g NSDocumentRevisionsWindowTransformAnimation -bool false
defaults write -g NSToolbarFullScreenAnimationDuration -float 0
defaults write -g NSBrowserColumnAnimationSpeedMultiplier -float 0
defaults write com.apple.dock autohide-time-modifier -float 0
View convuls_customquery.php
function convuls_customquery(){
// Set the arguments based on our get parameters
$today = date('Ymd',strtotime('today'));
$args = array (
'post_type' => 'evento',
'posts_per_page' => -1,
'meta_key' => 'fecha',
'meta_query' => array(
'event_selected' =>array(
View custom-rest-route.php
<?php
// Registramos una ruta nueva para la rest api
add_action( 'rest_api_init', function () {
register_rest_route( 'convulsio/v2', '/convulsio-events/',
array(
'methods' => 'GET',
'callback' => 'convuls_customquery'
)
);
});
View FacetWP cool pager
/*
* FacetWP Pagination
* You should print it with `echo facetwp_display( 'pager' );` if you prefer that to shortcode method
*/
function bf_custom_paginator_facetwp( $output, $params ) {
$output = '';
$page = (int) $params['page'];
$total_pages = (int) $params['total_pages'];
View Limitar la creación de términos de taxonomía por rol de usuario
add_action( 'pre_insert_term', function ( $term, $taxonomy )
{
return ( 'tutaxonomia' === $taxonomy && !current_user_can( 'manage_options' ) )
? new WP_Error( 'term_addition_blocked', __( 'No puedes añadir términos a esta taxonomía.' ) )
: $term;
}, 0, 2 );
View WordPress atemporal para CPT
/** Función que elimina todo rastro de fechas en los artículos */
function bf_remove_dates() {
if( is_singular('libros') ){
add_filter('the_time', '__return_false');
add_filter('get_the_time', '__return_false');
add_filter('the_modified_time', '__return_false');
add_filter('get_the_modified_time', '__return_false');
add_filter('the_date', '__return_false');
add_filter('get_the_date', '__return_false');
add_filter('the_modified_date', '__return_false');
View WordPress atemporal
/** Función que elimina todo rastro de fechas en los artículos */
function bf_remove_dates() {
add_filter('the_time', '__return_false');
add_filter('get_the_time', '__return_false');
add_filter('the_modified_time', '__return_false');
add_filter('get_the_modified_time', '__return_false');
add_filter('the_date', '__return_false');
add_filter('get_the_date', '__return_false');
add_filter('the_modified_date', '__return_false');
add_filter('get_the_modified_date', '__return_false');
You can’t perform that action at this time.