This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## SITE REFERRER BANNING | |
RewriteCond %{HTTP_REFERER} floating-share-buttons.com [NC,OR] | |
RewriteCond %{HTTP_REFERER} floating-share-buttons.com | |
RewriteRule .* - [F] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This will allow to sort/filter according to different meta key values | |
* ref: https://mathieuhays.co.uk/order-by-multiple-post-meta-in-wp-query/ | |
* | |
*/ | |
$args = array( | |
'post_type' => 'my_post_type', | |
'posts_per_page' => 10, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if( have_rows('repeater_field_name') ): // check if the repeater field has rows of data ?> | |
<?php while ( have_rows('repeater_field_name') ) : the_row(); // loop through the rows of data ?> | |
<?php $foo = get_sub_field('sub_field_name'); // getting a sub field value ?> | |
<?php endwhile; ?> | |
<?php else: // no rows found ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* author base url rewrire | |
* | |
*/ | |
function wp_author_base() { | |
global $wp_rewrite; | |
$author_slug = 'user-profile'; // change slug name here | |
$wp_rewrite->author_base = $author_slug; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[a-zA-Z0-9.!#$%&'*+-/=?\^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Some hacks and code snippets to make nodejs working smoothy on Ubuntu 14.04 / Elementary Freya 0.3 | |
**/ | |
/** | |
* nodejs installation from latest ppa | |
* ref: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server | |
*/ | |
curl -sL https://deb.nodesource.com/setup | sudo bash - | |
sudo apt-get install nodejs | |
sudo apt-get install build-essential |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* items to display total number of items and cost | |
* ref: https://gist.github.com/mikejolley/2044101 | |
*/ | |
<a class="cart-contents" | |
href="<?php echo WC()->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->cart_contents_count ), WC()->cart->cart_contents_count ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* custom admin css | |
* code for sage theme: https://roots.io/sage/ | |
* include this snippet in lib/assets.php | |
*/ | |
function load_custom_wp_admin_style() { | |
wp_register_style( 'custom_wp_admin_css', asset_path('styles/admin-style.css'), false, '1.0.0' ); | |
wp_enqueue_style( 'custom_wp_admin_css' ); | |
} | |
add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\\load_custom_wp_admin_style' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Manage google fonts of load_google_font() | |
* set GOOGLE_FONTS constant in config.php | |
* for roots.io, Sage wp theme, place this code in lib/extras.php | |
*/ | |
function load_google_fonts() { | |
if( ! defined( 'GOOGLE_FONTS' ) ) return; | |
echo '<link href="//fonts.googleapis.com/css?family=' . GOOGLE_FONTS . '" rel="stylesheet" type="text/css" />'."\n"; |