Jake Vanderwerf
2025-10-20 fcd6e159ee09cc4bbe99bbbadc61a6e83b24b5bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
 
add_action( 'wp_enqueue_scripts', 'eink_styles' );
 
function eink_styles() {
    wp_enqueue_style( 
        'eink',
        get_stylesheet_uri(),array(),1.279
    );
 
}
 
add_action('after_setup_theme', 'eink_theme_setup');
function eink_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];
}