Jake Vanderwerf
5 days ago 92e80666d516de64e488e04911c09e65a32e2a05
functions.php
@@ -1,69 +1,16 @@
<?php
add_action( 'wp_enqueue_scripts', 'eink_styles' );
add_action( 'wp_enqueue_scripts', 'jv_styles' );
function eink_styles() {
function jv_styles() {
   wp_enqueue_style( 
      'eink',
      'jv',
      get_stylesheet_uri(),array(),1.279
   );
}
add_action('after_setup_theme', 'eink_theme_setup');
function eink_theme_setup(){
add_action('after_setup_theme', 'jv_theme_setup');
function jv_theme_setup(){
    add_theme_support('align-wide');
}
function eink_get_random_style_definition($ID,$num=1){
    $definitions = eink_style_definitions();
    $out = '';
    if(array_key_exists($ID,$definitions)){
        $definitions = $definitions[$ID];
        $defs = array();
        for($i=1; $i<=$num; $i++){
            $def = eink_random_style($definitions,$defs);
            if($def){
                $defs[] = $def;
            }
        }
        if(!empty($defs)){
            $name = get_term($ID)->name;
            $out = '<section class="artists-thoughts"><h3>What Artists Love About '.$name.'</h3><ul class="list-none style-definitions">';
            foreach($defs as $d){
                $title = 'Learn more about '.$d['artist_name'];
                $out .= '<li>
                    <a href="'.$d['artist_url'].'" class="img" title="'.$title.'">'.$d['img'].'</a>
                    <div class="text">
                        <span class="quote"><svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" fill="currentColor" viewBox="0 0 256 256"><path d="M100,60H40A12,12,0,0,0,28,72v64a12,12,0,0,0,12,12h64v12a36,36,0,0,1-36,36,4,4,0,0,0,0,8,44.05,44.05,0,0,0,44-44V72A12,12,0,0,0,100,60Zm4,80H40a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4h60a4,4,0,0,1,4,4ZM216,60H156a12,12,0,0,0-12,12v64a12,12,0,0,0,12,12h64v12a36,36,0,0,1-36,36,4,4,0,0,0,0,8,44.05,44.05,0,0,0,44-44V72A12,12,0,0,0,216,60Zm4,80H156a4,4,0,0,1-4-4V72a4,4,0,0,1,4-4h60a4,4,0,0,1,4,4Z"></path></svg></span>
                        <blockquote>'.apply_filters('the_content',$d['definition']).'</blockquote>
                        <p class="artist">— <a href="'.$d['artist_url'].'" title="'.$title.'">'.$d['artist_name'].'</a></p>
                    </div>
                </li>';
            }
            $out .= '</ul></section>';
        }
    }
    return $out;
}
function eink_random_style(array $check, array $exclude = array()){
    if(!empty($exclude)){
        foreach($exclude as $ex){
            if(in_array($ex,$check)){
                unset($check[array_search($ex,$check)]);
            }
        }
    }
    if(empty($check)){
        return;
    }
    shuffle($check);
    shuffle($check);
    $max = count($check) - 1;
    $rand = rand(0,$max);
    return $check[$rand];
}