Skip to content

Instantly share code, notes, and snippets.

View sonnetmia's full-sized avatar
🏠
Working from home

Md. Ariful Islam sonnetmia

🏠
Working from home
View GitHub Profile
@sonnetmia
sonnetmia / functions.php
Created August 7, 2015 07:43
Bootstrap pagination Code example
<?php
function arf_defaultpagination() {
global $wp_query;
$big = 999999999;
$pages = paginate_links(array(
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' => '?page=%#%',
'current' => max(1, get_query_var('paged')),
'total' => $wp_query->max_num_pages,
'prev_next' => false,
@sonnetmia
sonnetmia / .htaccess
Last active August 29, 2015 14:26
htaccess hardeing for WordPress website
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
Header always append X-Frame-Options SAMEORIGIN
Header set X-Content-Type-Options: "nosniff”
#Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
Header always edit Set-Cookie (.*) "$1; HTTPOnly"
Header always edit Set-Cookie (.*) "$1; Secure"
</IfModule>
#from: http://codex.wordpress.org/Hardening_WordPress
@sonnetmia
sonnetmia / .htaccess
Last active June 10, 2020 15:44
WordPress htaccess security imporvement
###########################
# WP htaccess Boilerplate #
#Slightly modified to improve hardening#
###########################
### https://github.com/Creare/WP-htaccess/
############
# Security #
############
#User-agent: *
Disallow: /cgi-bin
Disallow: /wp-admin
Disallow: /wp-includes
Disallow: /wp-content/plugins/
Disallow: /wp-content/cache/
Disallow: /wp-content/themes/
Disallow: */trackback/
Disallow: */feed/
Disallow: /*/feed/rss/$
<div class="caption lfb boxshadow" data-x="center" data-y="center" data-speed="900" data-start="500" data-easing="easeOutBack">
<iframe width="1280" height="720" src="https://www.youtube.com/embed/F5lFIr9fC50" frameborder="0" allowfullscreen></iframe>
</div>
// Register Custom Post Type
function custom_services_post_type() {
$labels = array(
'name' => _x( 'Services', 'Post Type General Name', 'custom_textdomain' ),
'singular_name' => _x( 'Service', 'Post Type Singular Name', 'custom_textdomain' ),
'menu_name' => __( 'Services', 'custom_textdomain' ),
'name_admin_bar' => __( 'Services', 'custom_textdomain' ),
'archives' => __( 'Item Archives', 'custom_textdomain' ),
'parent_item_colon' => __( 'Parent Item:', 'custom_textdomain' ),
@sonnetmia
sonnetmia / Sublime Text 3 Build 3103 License Key - CRACK
Last active April 9, 2017 17:29
Sublime Text 3 Build 3103 License Key
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
@sonnetmia
sonnetmia / shipping_calculator.php
Last active June 2, 2016 03:05 — forked from WillBrubaker/gist:49ccb5365a8632b8af8e
Remove the postcode field from the WooCommerce shipping calculator
add_filter( 'woocommerce_shipping_calculator_enable_postcode', '__return_false' );
@sonnetmia
sonnetmia / functions.php
Created June 2, 2016 05:24 — forked from claudiosanches/functions.php
WooCommerce - Hide free shipping if others methods exists
<?php
/**
* Hide free shipping if others methods exists.
*
* @param array $available_methods
*/
function custom_shipping_rules( $available_methods ) {
if ( isset( $available_methods['PAC'] ) || isset( $available_methods['SEDEX'] ) ) {
unset( $available_methods['free_shipping'] );
@sonnetmia
sonnetmia / wp-config.php
Created June 20, 2016 14:56
Force WordPress update without ftp info in some case.
<?php
/** Sets up 'direct' method for WordPress to FTP, without requiring credentials */
define('FS_METHOD', 'direct');
/** Defines permissions for WordPress to apply to new directories */
define('FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
/** Defines permissions for WordPress to apply to new files */
define('FS_CHMOD_FILE', ( 0664 & ~ umask() ) );