Skip to content

Instantly share code, notes, and snippets.

@deeman
deeman / custom-favicon.php
Last active August 4, 2018 08:49
Custom Favicon in Genesis Framework
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Display a custom favicon
add_filter( 'genesis_pre_load_favicon', 'sp_favicon_filter' );
function sp_favicon_filter( $favicon_url ) {
//return 'http://www.mydomain.com/wp-content/themes/genesis-childtheme/images/favicon.ico';
//favicon via image-url(SSL/HTTPS).
return 'https://cdn4.iconfinder.com/data/icons/geomicons/32/672410-skull-16.png';
}
@deeman
deeman / uikit-wordpress.php
Last active September 11, 2017 22:40
Enque UI Kit with WordPress
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
add_action( 'wp_enqueue_scripts', 'custom_load_uikit' );
/**
* Load UIKit.
*/
function custom_load_uikit() {
wp_enqueue_style( 'uikit', '//cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.30/css/uikit.min.css' );
@deeman
deeman / font-awesome.php
Last active August 9, 2019 11:20
How to enqueue Font-Awesome in WordPress
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
// Load Font Awesome//
// Register Style, Codex version
function custom_styles() {
wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css', false, '4.1.0' );
}
add_action( 'wp_enqueue_scripts', 'custom_styles' );
@deeman
deeman / enque-bootstrap.php
Last active January 24, 2018 11:41
How to Enque Boostrap with WordPress
<?php
//* Do NOT include the opening php tag shown above.
add_action( 'wp_enqueue_scripts', 'custom_load_bootstrap' );
/**
* Enqueue Bootstrap.
*/
function custom_load_bootstrap() {
wp_enqueue_style( 'bootstrap-css', '//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css' );
wp_enqueue_script( 'bootstrap-js', '//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js', array( 'jquery' ), CHILD_THEME_VERSION, true );
//Add the following in your child theme’s functions.php
add_filter( 'comment_form_default_fields', 'comment_form_custom_fields' );
/**
* Remove Email and Website fields in comment form.
*
* @param array $args Default comment form arguments
* @return array Modified comment form arguments
*/
function comment_form_custom_fields( $args ) {
@deeman
deeman / functions.php
Last active July 9, 2018 07:55
Genesis Framework: Adding nav menu indicators using Font Awesome.
//* Enque and make Font Awesome available
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
function enqueue_font_awesome() {
wp_enqueue_style( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.css' );
}
@deeman
deeman / function.php
Created October 24, 2017 16:55
WooCommerce. Single product. Remove Additional Information
/**
* remove on single product panel 'Additional Information' since it already says it on tab.
*/
add_filter('woocommerce_product_additional_information_heading', 'isa_product_additional_information_heading');
function isa_product_additional_information_heading() {
echo '';
}
@deeman
deeman / functions.php
Last active July 16, 2019 07:07
Google Tag Manager (Genesis Framework)
<?php
// THIS VERSIN IS ONLY FOR GENESIS FRAMEWORK //
// Add Google Tag Manager code in <head>
add_action( 'wp_head', 'sk_google_tag_manager1' );
function sk_google_tag_manager1() { ?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
@deeman
deeman / automatic-meta-description.txt
Created November 16, 2017 23:39
(SEO) Create Meta Description From Content
This creates a custom SEO function for meta description.
The function automatically create (155 words) Meta Description From Content.
@deeman
deeman / wc-noindex-nofollow.php
Last active March 9, 2022 12:17
(SEO) WooCommerce "No Index, No Follow" on cart, order, checkout- pages then using YOAST!
function woo_seo_noindex_special_pages () {
global $post;
$woocommerce_pages = array('cart', 'checkout', 'order-received', 'order-tracking',
'my-account', 'logout', 'lost-password', 'mijireh-secure-checkout');
$slug = get_post($post)->post_name;
if (in_array($slug, $woocommerce_pages)) {
echo '<meta name="robots" content="noindex,follow"/>' . "\n";
}