Skip to content

Instantly share code, notes, and snippets.

Created April 22, 2013 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/5438249 to your computer and use it in GitHub Desktop.
Save anonymous/5438249 to your computer and use it in GitHub Desktop.
Hook de pre_get_posts
function cambia_queries ( $query ) {
if ( $query->is_category(31) && $query->is_main_query()){ //31 es la categoria donde quiero se muestre el cambio
$query->set('cat','18,31');//31 es la categoria actual, y 18 la categoria que quiero añadir para mostrar
}
}
add_action( 'pre_get_posts', 'cambia_queries');
// Cambiamos el query con pre_get_posts
add_action( 'pre_get_posts', 'cambia_queries' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment