Skip to content

Instantly share code, notes, and snippets.

View javierarques's full-sized avatar

Javier javierarques

View GitHub Profile
@javierarques
javierarques / gist:5444534
Last active April 6, 2017 14:34
Wordpress. Set custom template for taxonomies. Change default template. template_include filter
// Add the filter
add_filter( 'template_include', 'my_custom_template');
/**
* Returns customized templates for custom taxonomies
*
* @param string $template
* @return string
*/
function my_custom_template ( $template ) {
@javierarques
javierarques / Twig Absolute Url Function
Last active February 3, 2016 17:49
twig function to generate absolute URL's
/**
* absoluteUrl
* twig function to generate absolute URL's
*
* @param {string} $string fixed slug appended to Url
* @param {array} [$params] array with query string params to add to the Url
*
*/
$app['twig'] = $app->share($app->extend('twig', function($twig, $app) {
$twig->addFunction(new \Twig_SimpleFunction('absoluteUrl', function ($string, $params = []) use ($app) {
@javierarques
javierarques / gist:8577543
Created January 23, 2014 12:07
Woocommerce - Filter orders in wp-admin by products
/***********************************************************************************
* 2. FILTRO POR PRODUCTOS EN PEDIDOS
***********************************************************************************/
define('FILTRO_PRODUCT_NAME', 'filtro_producto');
define('ORDER_POST_TYPE', 'shop_order');
/**
* Añade la query de las sedes
* Hook 'pre_get_posts'
@javierarques
javierarques / gist:7150398
Created October 25, 2013 06:52
Unregister wp-login default css
function remove_wp_login_styles () {
add_filter( 'style_loader_tag', '__return_null' );
}
add_action( 'login_init', 'remove_wp_login_styles');
@javierarques
javierarques / gist:6669598
Created September 23, 2013 12:07
CSS3 calendar icon with SASS
// Calendar icon
//------------------------//
.calendar-icon {
// Contenedor principal
display: inline;
float: left;
height: 14px;
margin: 6px 3px 0 0;
position: relative;
@javierarques
javierarques / gist:5956890
Last active December 19, 2015 12:39
Pagination on Buddypress Components. Buddypress pagination. Buddypress rewrite rules
function bp_component_screen_controller() {
global $bp;
//Are we in the current type
if ( $bp->current_component == BP_YOUR_COMPONENT_SLUG ) {
// The directory.
if ( (empty( $bp->current_action ) || ($bp->current_action == 'page')) &&
(empty( $bp->action_variables ) || is_numeric($bp->action_variables[0]))) {
@javierarques
javierarques / Toggler.js
Created December 18, 2015 12:11
Toggler JS Component. Fire CSS classes
const Toggler = (() => {
"use strict";
//
// CONSTANTS
//
const TOGGLER_ATTR = '[data-toggler]';
const TOGGLER_ATTR_TARGET = 'data-toggler-target';
@javierarques
javierarques / gist:5713635
Created June 5, 2013 12:52
Share on Wordpress Compartir en Wordpress Compartir sin los javascript de Facebook ni Twitter en una ventana emergente
<ul class="share-buttons">
<li>¿Te ha gustado? Compártelo!</li>
<li><a href="javascript: return false;" onclick="window.open('http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php echo urlencode(get_the_title()) ?>','window','width=550,height=400')" class="btn btn-small"><i class="facebook"></i> Facebook</a></li>
<li><a href="javascript: return false;" onclick="window.open('https://twitter.com/share?url=<?php the_permalink();?>&text=<?php echo get_the_title() ?>&via=cuidadoinfantil','window','width=550,height=400')" class="btn btn-small"><i class="twitter"></i> Twitter</a></li>
<li><a href="javascript: return false;" onclick="window.open('https://plus.google.com/share?url=<?php the_permalink();?>','window','width=450,height=430')" class="btn btn-small"><i class="google"></i> Google+</a></li>
<? /* <li><a href="javascript: return false;" onclick="window.open('https://www.linkedin.com/cws/share?url=<?php the_permalink();?>&title=<?php echo urlencode(get_the_title())?>&original_referer=<?php
@javierarques
javierarques / gist:5684664
Created May 31, 2013 12:26
Dropdown for taxonomies
function dropdown_taxonomy ( $taxonomy, $all_option = 'todo') {
$terms = get_terms ( $taxonomy );
?>
<!-- START taxonomy Search -->
<select name="<?php echo $taxonomy ?>">
<option value=''><?php echo $all_option ?></option>
<?php foreach($terms as $term): ?>
<option value="<?php echo $term->name ;?>" <?php selected(get_query_var($taxonomy), $term->name, true) ?>>
<?php echo $term->name ?>
@javierarques
javierarques / SassMeister-input.scss
Created July 23, 2015 11:17
Generated by SassMeister.com.
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
// Number of slices of a 100% scale that will be generated
$steps: 20;
// Custom widths that will be generated among the proportions
$customWidths: (