Skip to content

Instantly share code, notes, and snippets.

View MZAWeb's full-sized avatar

Daniel Dvorkin MZAWeb

View GitHub Profile
<?php
add_filter( 'pre_get_posts', 'cambia_queries', 10, 1 );
function cambia_queries( $query ) {
if ( $query->is_category( 31 ) && $query->is_main_query() ) {
$query->set( 'cat', array( 18, 31 ) );
$query->set( 'posts_per_page', - 1 );
}
return $query;
Index: templates/default/bbpress-functions.php
===================================================================
--- templates/default/bbpress-functions.php (revision 4870)
+++ templates/default/bbpress-functions.php (working copy)
@@ -216,6 +216,10 @@
<?php if ( bbp_use_wp_editor() ) : ?>
jQuery(document).ready( function() {
+ /* Use backticks instead of <code> for the Code button in the editor */
+ edButtons[110] = new QTags.TagButton('code','code','`','`','c');
@MZAWeb
MZAWeb / gist:5467372
Last active December 16, 2015 16:59
@MZAWeb
MZAWeb / gist:5685950
Created May 31, 2013 15:52
Fork bomb
:(){ :|:& };:
@MZAWeb
MZAWeb / composer.json
Created June 7, 2013 04:36
composer.json file to install WP_Mock and it's dependencies
{
"repositories": [
{
"type" : "package",
"package": {
"name" : "hamcrest/hamcrest",
"version" : "1.1.0",
"dist" : {
"type": "zip",
"url" : "https://hamcrest.googlecode.com/files/hamcrest-php-1.1.0.zip"
<?php
function custom_excerpt_length( $length ) {
$la_cantidad_de_caracteres_que_quieras = 20;
return $la_cantidad_de_caracteres_que_quieras;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
@MZAWeb
MZAWeb / functions.php
Created August 14, 2013 20:32
Cambiar theme según sección
<?php
add_action( 'wp', 'elegir_theme' );
function elegir_theme() {
// Aca pones la condición que quieras verificar para decidir si cambiar el theme...
// Puede ser cualquier cosa, obviamente... is_page, is_tax, or cualquier cosa que necesites.
if ( is_page( 2 ) ) {
add_filter( 'stylesheet', 'cambiar_theme', 10, 1 );
add_filter( 'template', 'cambiar_theme', 10, 1 );
@MZAWeb
MZAWeb / functions.php
Created August 18, 2013 10:38
Playing with the new do_accordion_sections
<?php
add_action( 'edit_form_after_editor', 'testing_accordion_section' );
function testing_accordion_section() {
$screen = get_current_screen();
do_accordion_sections( $screen, 'normal', get_post() );
nmap <Leader>a) :Tabularize /)<CR>
vmap <Leader>a) :Tabularize /)<CR>
nmap <Leader>aa :Tabularize /array<CR>
vmap <Leader>aa :Tabularize /array<CR>
let g:spf13_no_indent_guides_autocolor=1
UnBundle 'vim-scripts/sessionman.vim'
UnBundle 'vim-indent-guides'
let g:gist_clip_command = 'pbcopy'
@MZAWeb
MZAWeb / php.php
Created September 4, 2013 16:33
Testing Hall
<?php
echo "Let's see if this shit embeds gists somehow";