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 | |
function excerpt($limit) { | |
$excerpt = explode(' ', get_the_excerpt(), $limit); | |
if (count($excerpt)>=$limit) { | |
array_pop($excerpt); | |
$excerpt = implode(" ",$excerpt).'...'; | |
} else { | |
$excerpt = implode(" ",$excerpt); | |
} |
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 | |
/* | |
* Create Saved Orders Custom Table | |
*/ | |
function woo_create_saved_orders_data_table() { | |
global $wpdb; | |
$charset_collate = $wpdb->get_charset_collate(); | |
$table_name = $wpdb->prefix . 'woocommerce_saved_orders'; |
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 this to your functions.php of your child theme | |
function generatepress_custom_copyright() { | |
$copyrightCustomizer = get_theme_mod('generate_copyright'); | |
if ( !empty($copyrightCustomizer) ) { | |
$date = date('Y'); | |
$copyrightCustomizer = str_replace( '%current_year%', $date, $copyrightCustomizer ); | |
$copyright = str_replace( '%copy%', '©', $copyrightCustomizer ); | |
// change this to what you want after the copyright |
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
function jm_xmas_announcement() { | |
$xmascta = '<div class="xmas-announcement" style="background:#e6092a;text-align:center;padding:10px;">'; | |
$xmascta .= '<a href="' . get_page_link(350) . '" style="color:white;text-transform:uppercase;">'; | |
$xmascta .= '<p style="margin-bottom:0;padding:10px;border:1px solid white;">Now Taking Christmas Orders</p>'; | |
$xmascta .= '</a>'; | |
$xmascta .= '</div>'; | |
$now = time(); | |
$year = date('Y'); | |
$promo = strtotime("01 November $year"); |
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
function jm_enqueue_scripts() { | |
// Gets the last time the style sheet was updated | |
$version = filemtime( get_stylesheet_directory() . '/style.css' ); | |
// Enqueues style.css and assigns version to ensure browser cache is dropped | |
wp_enqueue_style( 'arbaros-styles', get_stylesheet_directory_uri() . '/style.css', array(), $version, 'all' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'jm_enqueue_scripts' ); |
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
function wcd_hide_admin_sections() { | |
$user = wp_get_current_user(); | |
$access = 'admin'; // this is your username that gets access | |
if($user && isset($user->user_login) && $access != $user->user_login) { ?> | |
<style> | |
li#toplevel_page_edit-post_type-acf-field-group, | |
li#menu-appearance, | |
li#menu-plugins, | |
li#menu-users, | |
li#menu-settings, |
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 | |
/* | |
* Use the function if ( the_slug_exists( '404' ) ) {} to detect if is in database | |
*/ | |
function the_slug_exists($post_name) | |
{ | |
global $wpdb; | |
if($wpdb->get_row("SELECT post_name FROM wp_posts WHERE post_name = '" . $post_name . "'", 'ARRAY_A')) { | |
return true; |
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 | |
/** | |
* Just place your CPT template in the root directory of the plugin eg: single-portfolio.php | |
* This function allows it to be overridden via a child theme etc | |
*/ | |
function tammy_portfolio_template( $template ) { | |
global $post; | |
$post_type = 'portfolio'; // change post type name here if required |
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
$( 'img.svg' ).each( function() { | |
var $img = jQuery( this ), | |
imgID = $img.attr( 'id' ), | |
imgClass = $img.attr( 'class' ), | |
imgURL = $img.attr( 'src' ); | |
$.get( imgURL, function( data ) { | |
// Get the SVG tag, ignore the rest | |
var $svg = jQuery( data ).find( 'svg' ); |
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 | |
function iodine_is_active() { | |
if ( !class_exists('Iodine_Plugin') ) { | |
?> | |
<div class="notice notice-error is-dismissible"> | |
<p> | |
<a target="_blank" | |
href="https://github.com/saltnpixels/Iodine"> <?php _e( 'This theme works best with iodine installed!!', 'digipress' ); ?></a> | |
</p> |
OlderNewer