Skip to content

Instantly share code, notes, and snippets.

View tiendungdev's full-sized avatar

Tien Dung Dao tiendungdev

View GitHub Profile
@tiendungdev
tiendungdev / class-wp-numeric-pagination.php
Created March 18, 2018 15:40 — forked from cyberwani/class-wp-numeric-pagination.php
Wordpress Numeric Pagination Class that enables you to set the classes of each LI and A html tag.
<?php
/**
* Numeric Pagination Class
* @author Alexandre Plennevaux https://pixeline.be
*
* This class returns a list of LI > A. It is up to you to set the wrapping NAV > UL around your function call.
*
* @usage (setting specific classes)
*
* // Sets the css classes you want to be used for the output
@tiendungdev
tiendungdev / media-query.css
Created March 20, 2018 05:01 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@tiendungdev
tiendungdev / index.php
Created April 5, 2018 05:20 — forked from jbutko/index.php
PHP, WP, Contact Form 7: Echo Contact Form 7 form if it is installed (if function_exists)
<?php
if (function_exists('wpcf7')) {
echo do_shortcode( '[contact-form-7 id="413" title="Contact form 1"]' );
} else {
echo "<p class='title'>Please install <a href='http://wordpress.org/plugins/contact-form-7/' rel='nofollow'>Contact Form 7</a> plugin and build some contact form. Then use your shortcode on the contact page.</p>";
}
?>
@tiendungdev
tiendungdev / gist:03d39a0c1d41a20564da533f956e87d2
Created September 24, 2018 16:31 — forked from jessbudd/gist:66232f577743fd5fa1b542c48b102f20
Woocommerce best selling product loop
<?php
$args = array(
'post_type' => 'product',
'stock' => 1,
'posts_per_page' => 4,
'meta_key' => 'total_sales',
'orderby' => 'meta_value_num',
'tax_query' => array( //do not return results from this category
array(
'taxonomy' => 'product_cat',
@tiendungdev
tiendungdev / like-it-enqueue.php
Created May 3, 2019 06:32 — forked from shizhua/like-it-enqueue.php
Add a like button without a plugin in WordPress
add_action( 'wp_enqueue_scripts', 'pt_like_it_scripts' );
function pt_like_it_scripts() {
if( is_single() ) {
wp_enqueue_style( 'like-it', trailingslashit( plugin_dir_url( __FILE__ ) ).'css/like-it.css' );
if (!wp_script_is( 'jquery', 'enqueued' )) {
wp_enqueue_script( 'jquery' );// Comment this line if you theme has already loaded jQuery
}
wp_enqueue_script( 'like-it', trailingslashit( plugin_dir_url( __FILE__ ) ).'js/like-it.js', array('jquery'), '1.0', true );
@tiendungdev
tiendungdev / .htaccess
Created December 13, 2019 15:56 — forked from seoagentur-hamburg/.htaccess
UPDATE 2019/07: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2019
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://andreas-hecht.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################