Skip to content

Instantly share code, notes, and snippets.

@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' );
//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 / 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 / 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 );
@deeman
deeman / wc-noindex-orderby
Created April 23, 2018 22:16
SEO & WooCommerce - Prevent indexing "Order by"
add_action( 'wp_head', 'cp_prevent_indexing_orderby' );
if(!function_exists('cp_prevent_indexing_orderby')){
function cp_prevent_indexing_orderby () {
if (isset($_GET['orderby'])){
echo '<meta name="robots" content="noindex, nofollow">';
}
}
}
@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 / 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 / admin-widget-areas.php
Created August 9, 2018 11:10
Unregister Widget Areas in Admin
/*
* Comment out the ones you want to keep. You will need some, but not all, for each project.
* Also, if you un-register then you can't use the_widget();
*/
add_action( 'widgets_init', 'cab_unregister_widgets', 10 );
/**
* Unregister Various Widgets
* Clean up your widgets.php page
* Single comment out the ones you want to keep
@deeman
deeman / genesis-before-footer.php
Last active August 9, 2018 11:14
Genesis: How to Create A widget area before footer
@deeman
deeman / functions.php
Created August 27, 2018 12:20
Genesis Framework - Modify read more link
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Modify the Genesis Franework read more link
add_filter( 'get_the_content_more_link', 'sp_read_more_link' );
function sp_read_more_link() {
return '<a class="more-link" href="' . get_permalink() . '">Continue Reading →</a>';
}