Skip to content

Instantly share code, notes, and snippets.

View taninbkk's full-sized avatar

Tanin taninbkk

View GitHub Profile
@taninbkk
taninbkk / style.css
Last active August 29, 2015 14:17
Left sidebar under main-content on Mobile - Bootstrap 3
/* make default sidebar put under main content */
/* force devices more than 980px */
@media (min-width: 981px) {
#sidebar {
float:left;
}
#main {
float:right;
}
}
@taninbkk
taninbkk / functions.php
Last active November 1, 2023 07:55
Polylang Shortcode
// Polylang Shortcode - https://wordpress.org/plugins/polylang/
// Add this code in your functions.php
// Put shortcode [polylang] to post/page for display flags
function polylang_shortcode() {
ob_start();
pll_the_languages(array('show_flags'=>1,'show_names'=>0));
$flags = ob_get_clean();
return $flags;
}
/* WooCommerce Checkout Page - Fix Paypal Label */
.woocommerce-checkout .woocommerce-checkout-payment ul li label {
width: auto;
display: inline;
}
@taninbkk
taninbkk / functions.php
Last active April 13, 2020 06:50
Wordpress Child Theme Overriding Parent
// Credit @rmulugeta https://wordpress.org/support/users/rmulugeta/
// from https://wordpress.org/support/topic/child-theme-not-overriding-parent-stylecss/
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles',999 );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/styles/child-style.css',
array('parent-style')
);
@taninbkk
taninbkk / functions.php
Last active June 1, 2017 08:33
add custom class to wordpress body class (woocommerce shop page)
add_filter( 'body_class', 'custom_class' );
function custom_class( $classes ) {
if (is_shop()) {
$classes[] = 'shop';
}
return $classes;
}
@taninbkk
taninbkk / functions.php
Last active July 21, 2017 13:23
Facebook and Line Inbox button under Add to Cart on WooCommerce Single Product Page
/* add additional button on single product page for woocommerce */
add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 31 );
function my_extra_button_on_product_page() {
global $product;
echo '<div class="social-order">';
echo '<a href="https://m.me/FACEBOOK_PAGE_USER_NAME_HERE" target="_blank" class="button large facebook-btn"><span class="fa fa-facebook-square fa-2x" aria-hidden="true"></span> สั่งซื้อทาง Facebook</a>';
echo '<a href="http://line.me/ti/p/~LINE_ID_HERE" target="_blank" class="button line-btn"><span class="icon icon-line fa-2x"></span> สั่งซื้อทาง Line</a>';
echo '</div>';
}