Skip to content

Instantly share code, notes, and snippets.

View DarioBF's full-sized avatar
⌨️

DarioBF

⌨️
View GitHub Profile
@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
@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 / CPTs 2
Last active November 28, 2020 05:57
// Lo enganchamos en la acción init y llamamos a la función create_book_taxonomies() cuando arranque
add_action( 'init', 'create_book_taxonomies', 0 );
// Creamos dos taxonomías, género y autor para el custom post type "libro"
function create_book_taxonomies() {
/* Configuramos las etiquetas que mostraremos en el escritorio de WordPress */
$labels = array(
'name' => _x( 'Géneros', 'taxonomy general name' ),
'singular_name' => _x( 'Género', 'taxonomy singular name' ),
'search_items' => __( 'Buscar por Género' ),
@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' );
add_action( 'init', 'bf_register_custom_post_type' );
/**
* Registro un custom post type 'libro'.
*
* @link http://codex.wordpress.org/Function_Reference/register_post_type
*/
function bf_register_custom_post_type() {
/* Añado las etiquetas que aparecerán en el escritorio de WordPress */
$labels = array(
'name' => _x( 'Libros', 'post type general name', 'text-domain' ),
/**
* 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();
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'
)
);
});