This file contains 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 | |
/* | |
* Add a hidden field to our WooCommerce login form - passing in the refering page URL | |
* Note: the input (hidden) field doesn't actually get created unless the user was directed | |
* to this page from a single product page | |
*/ | |
function redirect_user_back_to_product() { | |
// check for a referer | |
$referer = wp_get_referer(); | |
// if there was a referer.. |
This file contains 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 | |
/** | |
* Template Name: Site Map Page | |
* | |
* @package Scaffolding | |
* @since Scaffolding 1.1 | |
*/ | |
get_header(); |
This file contains 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 | |
/** | |
* H1 Tag Template | |
* | |
* This is a tuckaway H1 tag for SEO purposes. | |
*/ | |
// Set Variables | |
$h1_field = 'h1_tag'; // the field name defined in acf | |
$default_posttype = 'News'; // ex. Posts or News |
This file contains 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
// Redirect non-admins to the homepage after logging into the site. | |
function nonadmin_login_redirect( $redirect_to, $request, $user ) { | |
return ( is_array( $user->roles ) && in_array( 'administrator', $user->roles ) ) ? admin_url() : site_url(); | |
} | |
add_filter( 'login_redirect', 'nonadmin_login_redirect', 10, 3 ); |
This file contains 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 | |
/** | |
* truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags | |
* | |
* @param string $text String to truncate. | |
* @param integer $length Length of returned string, including ellipsis. | |
* @param string $ending Ending to be appended to the trimmed string. | |
* @param boolean $exact If false, $text will not be cut mid-word | |
* @param boolean $considerHtml If true, HTML tags would be handled correctly | |
* |