Skip to content

Instantly share code, notes, and snippets.

View jartes's full-sized avatar
🦖

Joan Artés jartes

🦖
View GitHub Profile
@jartes
jartes / seo-slugs.php
Created May 19, 2014 12:18
Seo Slugs WP
<?php
/*
Plugin Name: SEO Slugs
Plugin URI: http://www.vretoolbar.com/news/seo-slugs-wordpress-plugin
Description: Removes common words like 'a', 'the', 'in' from post slugs to improve SEO.
Version: 1.0
Author: Andrei Mikrukov
Author URI: http://www.vretoolbar.com
*/
@jartes
jartes / callback-infinite-scroll-flexslider.php
Last active August 29, 2015 14:01
Ejemplo callback FlexSlider Infinite Scroll
<?php
function add_intinite_scroll_callback( $options ) {
$options['callback'] .= '
jQuery(this).find(".flexslider").each(function(index) {
if ( jQuery(this).attr( "slider-loaded" ) === "0" ) {
@jartes
jartes / flexslider-basico-infinite-scroll.html
Created May 16, 2014 15:03
Ejemplo de FlexSlider Básico preparado para Infinite Scroll
<div class="flexslider" slider-started="0" slider-type="basico" slider-animation="slide">
<ul class="slides">
<li>
<img src="slide1.jpg" />
</li>
<li>
<img src="slide2.jpg" />
</li>
<li>
<img src="slide3.jpg" />
@jartes
jartes / flexslider-basico.html
Created May 16, 2014 14:07
Ejemplo de FlexSlider Básico
<div class="flexslider">
<ul class="slides">
<li>
<img src="slide1.jpg" />
</li>
<li>
<img src="slide2.jpg" />
</li>
<li>
<img src="slide3.jpg" />
@jartes
jartes / wc-add-button-cart-item.php
Created March 25, 2014 17:58
WooCommerce - Add "update cart" button on all cart items . Props igmoweb
<?php
function fanatic_add_update_cart_item( $product_quantity, $cart_item_key ) {
global $woocommerce;
$cart = $woocommerce->cart->get_cart();
$product = $cart[ $cart_item_key ]['data'];
$product_id = $product->id;
if ( $product->is_sold_individually() === false ) {
$product_quantity .= '<input type="submit" class="update-qty" name="update_cart" value="'.__( 'Update Cart', 'woocommerce' ).'" />';
}
return $product_quantity;
@jartes
jartes / wp-pagination.php
Last active December 1, 2020 15:25
WordPress Custom Pagination
<?php
// Place this function into your functions.php theme file
function pagination($pages = '', $range = 4) {
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '') {
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages) {
@jartes
jartes / README.md
Last active September 6, 2016 15:24
WooCommerce - Is out of stock category

WooCommerce - Is out of stock category

Overview

This function checks if all products belonging to a product category or custom taxonomy is out of stock.

This function uses Transients API to cache 1 hour the result for avoiding large amount of querys.

Usage

@jartes
jartes / wpcf7-acceptance
Created March 10, 2014 16:03
Control WPCF7 Acceptance
jQuery('#check-term').bind('change', function() {
if(jQuery(this).is(':checked')){
jQuery("#acepta-condiciones").hide();
}
else {
jQuery("#acepta-condiciones").show();
}
});
<?php
/*
UPDATED: December 31, 2011.
Modifications:
- Truncated the longest country names, including:
-- British Indian Ocean Territories (Chagos Archipelago) -> British Indian Ocean Territories
-- South Georgia and the South Sandhich Islands -> South Georgia & S. Sandwich Islands
@jartes
jartes / birthday.php
Created July 10, 2013 12:27
Formulario fecha de nacimiento
<select name="dia" id="dia">
<option value=""></option>
<?php
$i = 1;
while ( $i <= 31 ) {
if ( $i < 10 ) {
$dia = '0' . $i;
}