Skip to content

Instantly share code, notes, and snippets.

View marcosnakamine's full-sized avatar

Marcos Nakamine marcosnakamine

View GitHub Profile
@marcosnakamine
marcosnakamine / wc-skeleton-shipping-method-example.php
Created July 24, 2020 14:04 — forked from woogists/wc-skeleton-shipping-method-example.php
[Shipping Method API] WooCommerce skeleton shipping method plugin code example.
<?php
/*
Plugin Name: Your Shipping plugin
Plugin URI: https://woocommerce.com/
Description: Your shipping method plugin
Version: 1.0.0
Author: WooThemes
Author URI: https://woocommerce.com/
*/
namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
animation: "fade", //String: Select your animation type, "fade" or "slide"
easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
reverse: false, //{NEW} Boolean: Reverse the animation direction
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
startAt: 0, //Integer: The slide that the slider should start on. Array nota
@marcosnakamine
marcosnakamine / functions.php
Last active April 11, 2017 13:49 — forked from bwhli/Redirect WordPress Logout to Home Page
WordPress - Change logout redirect
<?php
//* Redirect WordPress Logout to Home Page
add_action( 'wp_logout', create_function( '', 'wp_redirect( home_url() ); exit();' ) );
@marcosnakamine
marcosnakamine / functions.php
Created March 15, 2017 14:19 — forked from claudiosanches/functions.php
WooCommerce - Redirect to checkout after add product to the cart
<?php
/**
* Add to cart redirect to checkout.
*
* @param string $url
* @return string
*/
function my_wc_add_to_cart_redirect_to_checkout( $url ) {
return wc_get_checkout_url();
@marcosnakamine
marcosnakamine / index.php
Created March 15, 2017 14:09 — forked from claudiosanches/page-template.php
WordPress - List all posts gruped by category.
<?php
foreach ( get_categories( array( 'orderby' => 'name', 'order' => 'ASC' ) ) as $category ) {
$posts = get_posts( array(
'showposts' => -1,
'category__in' => array( $category->term_id ),
'ignore_sticky_posts' => 1
) );
if ( $posts ) {
echo '<h4>' . __( 'Categoria:' ) . ' <a href="' . get_category_link( $category->term_id ) . '">' . $category->name . '</a></h4>';
foreach ( $posts as $post ) {
@marcosnakamine
marcosnakamine / functions.php
Last active March 6, 2017 18:44 — forked from jameskoster/functions.php
WooCommerce - Change number of products per row
<?php
// Change number or products per row to 3
add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
function loop_columns() {
return 3; // 3 products per row
}
}
@marcosnakamine
marcosnakamine / functions.php
Last active March 10, 2017 13:18 — forked from agusmu/functions1a.php
WooCommerce - Custom categories and tags label
<?php
/* Customize Product Categories Labels */
add_filter( 'woocommerce_taxonomy_args_product_cat', 'custom_wc_taxonomy_args_product_cat' );
function custom_wc_taxonomy_args_product_cat( $args ) {
$args['label'] = __( 'Product Categories', 'woocommerce' );
$args['labels'] = array(
'name' => __( 'Product Categories', 'woocommerce' ),
'singular_name' => __( 'Product Category', 'woocommerce' ),
'menu_name' => _x( 'Categories', 'Admin menu name', 'woocommerce' ),
'search_items' => __( 'Search Product Categories', 'woocommerce' ),
@marcosnakamine
marcosnakamine / functions.php
Last active March 29, 2017 11:18 — forked from WPprodigy/functions.php
WooCommerce - Remove the password strength meter
<?php
add_action( 'wp_print_scripts', 'wc_remove_password_strength', 100 );
function wc_remove_password_strength() {
if ( wp_script_is( 'wc-password-strength-meter', 'enqueued' ) ) {
wp_dequeue_script( 'wc-password-strength-meter' );
}
}
@marcosnakamine
marcosnakamine / functions.php
Last active March 10, 2017 13:18 — forked from jameskoster/functions.php
WooCommerce - Declare support in theme
<?php
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
@marcosnakamine
marcosnakamine / functions.php
Last active March 10, 2017 13:18 — forked from jameskoster/functions.php
WooCommerce - Change number of columns on archives
<?php
add_filter( 'projects_loop_columns', 'jk_projects_columns', 99 );
function jk_projects_columns( $cols ) {
$cols = 3;
return $cols;
}