Skip to content

Instantly share code, notes, and snippets.

@edwinvelez
edwinvelez / functions.php
Created Aug 10, 2020
Add Custom CSS to Genesis Page Sections
View functions.php
<?php
/**
* Genesis Markup Filter Reference
*
* @author Edwin Velez (https://edwinvelez.net)
* @link https://edwinvelez.com/custom-css-genesis-page-sections/
*/
// Add filters to site containers for adding classes.
View functions.php
<?php
/**
* How to Customize Genesis SEO Title
*
* @author Edwin Velez (https://edwinvelez.com)
* @link https://edwinvelez.com/customize-genesis-seo-title/
*/
add_filter( 'genesis_seo_title', 'ev_custom_seo_title', 10, 3 );
@edwinvelez
edwinvelez / functions.php
Created Jul 20, 2020
Customize Genesis Site Footer
View functions.php
<?php
/**
* How to Customize Genesis Site Footer
*
* @author Edwin Velez (https://edwinvelez.com)
* @link https://edwinvelez.com/customize-genesis-site-footer
*/
// Comment or uncomment below filter or action as needed.
View my-plugin-file.php
<?php
/**
* Create an array of strings based on this file's absolute file system path as found in this plugin's root
* directory (not web root). Each index of the array is delimited by a forward slash "/".
*/
$this_file_tokenized_path = explode( '/', plugin_basename( __DIR__ ) );
$this_plugin_root_dir_name = $this_file_tokenized_path[ 0 ];
$substr_start_pos = strpos( plugin_dir_path( __DIR__ ), $this_plugin_root_dir_name );
View functions.php
<?php
$current_user = wp_get_current_user()->roles;
if ( in_array('administrator', $current_user) ) {
echo 'Current user is an administrator.';
}
View functions.php
<?php
/**
* Edwin Velez
*
* Starting point for all WordPress themes.
*
* @package EdwinVelez
* @author Edwin Velez (https://edwinvelez.net)
* @license GPL-2.0-or-later
@edwinvelez
edwinvelez / genesis-build-sidebar-toc.js
Created Jun 14, 2019
Build Table of Contents in Sidebar of a Genesis Theme
View genesis-build-sidebar-toc.js
/**
* Scans for <h1> to <h6> HTML tags contained within 'genesis-content' and builds a Table of Contents in the primary
* sidebar.
*
* @summary Dynamically builds a Table of Contents for in page navigation.
* @author Edwin Velez (edwinvelez.net)
*
* @version 1.0.1
*/
@edwinvelez
edwinvelez / external_links.js
Last active Apr 25, 2019
Open External Links in New Tab
View external_links.js
@edwinvelez
edwinvelez / functions.php
Created Mar 13, 2019
Set Reading Settings on Theme Activation
View functions.php
<?php
/**
* Set Reading Settings on Theme Activation
*
* @author Edwin Velez (https://edwinvelez.net)
* @link https://edwinvelez.net/set-reading-settings-on-theme-activation/
*/
function ev_set_reading_settings() {
@edwinvelez
edwinvelez / functions.php
Last active May 20, 2019
Compare Two Domain Name Values
View functions.php
<?php
/**
* Compare Two Domain Name Values
*
* @author Edwin Velez (https://edwinvelez.net)
* @link https://edwinvelez.net/compare-two-domain-name-values/
*/
// The domain name or host you want to compare. Can also be a host i.e. http://localhost
You can’t perform that action at this time.