Skip to content

Instantly share code, notes, and snippets.

View DarioBF's full-sized avatar
⌨️

DarioBF

⌨️
View GitHub Profile
@DarioBF
DarioBF / functions.php
Created September 27, 2021 09:48
Which template is WordPress using?
add_action('wp_head', 'show_template');
function show_template() {
global $template;
echo basename($template);
}
{
"data": {
"reviewer": [
{
"id": 1,
"name": "susan smith",
"job": "web developer",
"text": "I'm baby meggings twee health goth +1. Bicycle rights tumeric chartreuse before they sold out chambray pop-up. Shaman humblebrag pickled coloring book salvia hoodie, cold-pressed four dollar toast everyday carry"
},
{
// Add custom editor font sizes.
add_theme_support(
'editor-font-sizes',
array(
array(
'name' => __( 'Smallest', 'dariobf' ),
'shortName' => __( 'XXS', 'dariobf' ),
'size' => '.625rem',
'slug' => 'smallest',
),
@DarioBF
DarioBF / script.js
Created July 1, 2020 07:14
Remove jQuery from WordPress completely
/** * 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' );
/**
* 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 November 8, 2019 08:59
Disable MacOS animations (faster experience)
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
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(
<?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'
)
);
});
/*
* 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'];
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 );