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
/** | |
* Check if a page is child of another | |
* Ref: http://bavotasan.com/2011/is_child-conditional-function-for-wordpress/ | |
* | |
* @param mixed $page_id_or_slug Provide the parent ID or Slug | |
* @return bool Whether the page is child or not of the given parent | |
*/ | |
function is_child( $page_id_or_slug ) | |
{ | |
global $post; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Box Shadow</title> | |
<style> | |
.box { | |
height: 150px; | |
width: 300px; | |
margin: 20px; |
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
/** | |
* Remove Open Sans that WP adds from frontend | |
*/ | |
if (!function_exists('remove_wp_open_sans')) : | |
function remove_wp_open_sans() { | |
wp_deregister_style( 'open-sans' ); | |
wp_register_style( 'open-sans', false ); | |
} | |
add_action('wp_enqueue_scripts', 'remove_wp_open_sans'); | |
// Uncomment below to remove from admin |
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"; |
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
/** | |
* 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
/** | |
* 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
[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
<?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; | |
} |