Skip to content

Instantly share code, notes, and snippets.

DarioBF

Block or report user

Report or block DarioBF

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 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');
View CPTs 3
// Añado otra taxonomía, esta vez no es jerárquica, como las etiquetas.
$labels = array(
'name' => _x( 'Escritores', 'taxonomy general name' ),
'singular_name' => _x( 'Escritor', 'taxonomy singular name' ),
'search_items' => __( 'Buscar Escritores' ),
'popular_items' => __( 'Escritores populares' ),
'all_items' => __( 'Todos los escritores' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Editar Escritor' ),
You can’t perform that action at this time.