Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 1 commit
  • 2 files changed
  • 0 comments
  • 1 contributor
Oct 18, 2012
Media Function Fix
Shit's not clickable if it doesn't have extras!
b8adb5c
50  functions.php
@@ -86,9 +86,11 @@ function get_treatment_meta($post_id) {
86 86
 
87 87
 function get_media_bricks() {
88 88
     
  89
+    // Include the JS libs
89 90
     echo '<script src="'.THEME_URI.'/js/jquery.masonry.min.js" type="text/javascript"></script>';
90 91
     echo '<script src="'.THEME_URI.'/js/jquery.prettyPhoto.js" type="text/javascript"></script>';
91 92
     
  93
+    // Get all mediaMentions
92 94
     $bricks = new WP_Query(array(
93 95
         'posts_per_page' => -1,
94 96
         'post_type' => 'mediaMention'
@@ -98,14 +100,15 @@ function get_media_bricks() {
98 100
     $bricky_doodle_doo = array();
99 101
     $brick_media = array();
100 102
     
  103
+    // For each mention
101 104
     while ($bricks->have_posts()) {
102 105
         
103 106
         $bricks->the_post();
104 107
         $t = get_the_title();
105 108
         $i = get_the_ID();
106 109
         $m = get_post_meta($i);
107  
-        $m['_media_cover'] ? $cover = $m['_media_cover'] : $cover = null;
108  
-        $m['_media_addtl'] ? $addtl = $m['_media_addtl'] : $addtl = null;
  110
+        $m['_media_cover'] ? $cover = $m['_media_cover'] : $cover = false;
  111
+        $m['_media_addtl'] ? $addtl = $m['_media_addtl'] : $addtl = false;
109 112
         
110 113
         $bricky_doodle_doo[$t] = array(
111 114
             'cover' => $cover[0],
@@ -114,9 +117,12 @@ function get_media_bricks() {
114 117
     }
115 118
     
116 119
     foreach ($bricky_doodle_doo as $k => $media) {
  120
+        
117 121
         $safe_title = preg_filter('/(\s)/', '_', $k);
118 122
         
119  
-        if (is_array($media['addtl'])) {
  123
+        $link = ($media['addtl'][0] != '') ? true : false;
  124
+        
  125
+        if ($link) {
120 126
             
121 127
             foreach ($media['addtl'] as $number => $pic_path) {
122 128
                 $media['addtl'][$number] = "'".$pic_path."'";
@@ -124,23 +130,33 @@ function get_media_bricks() {
124 130
             
125 131
             $gallery = implode(', ', $media['addtl']); 
126 132
                 
127  
-                }
128  
-            else $gallery = '';
  133
+        }
  134
+        
  135
+        $js = '';
  136
+        
  137
+        if ($link) {
  138
+            $js = "<script type='text/javascript'>"
  139
+                   .$safe_title."_gallery = [".$gallery."];"
  140
+                   .$safe_title."_titles = [];"
  141
+                   .$safe_title."_descriptions = [];"
  142
+                   ."</script>";
  143
+            }
129 144
         
130  
-        echo "
131  
-            <script type='text/javascript'>
132  
-                ".$safe_title."_gallery = [".$gallery."];
133  
-                ".$safe_title."_titles = [];
134  
-                ".$safe_title."_descriptions = [];
135  
-            </script>
136  
-            <div class='box'>
137  
-                <a href='#' onclick='jQuery.prettyPhoto.open(".$safe_title."_gallery, ".$safe_title."_titles, ".$safe_title."_descriptions); return false'>
138  
-                    <img src='" . $media['cover'] . "'>
139  
-                </a>
140  
-            </div>";
  145
+        $output = "<div class='box'>";
  146
+        
  147
+        if ($link)
  148
+            $output .= "<a href='#' onclick='jQuery.prettyPhoto.open(".$safe_title."_gallery, ".$safe_title."_titles, ".$safe_title."_descriptions); return false'>";
  149
+        
  150
+        $output .= "<img src='" . $media['cover'] . "'>";
  151
+        
  152
+        if ($link)
  153
+            $output .= "</a>";
  154
+        
  155
+        $output .= "</div>";
  156
+        
  157
+        echo $js.$output;
141 158
     }
142 159
     
143  
-    
144 160
 }
145 161
 
146 162
 function thumbnail_src($id, $str) {
14  less/styles.less
@@ -139,17 +139,17 @@ p { .display(12px); }
139 139
         a {color:@darkpurple; font-weight:bold }
140 140
     }
141 141
     
142  
-    li.current-menu-parent {
143  
-        ul.sub-menu li.current-menu-item a {
144  
-            font-weight:bold; 
145  
-            color:@darkpurple;
146  
-            &:hover {color:@darkpurple;}
147  
-            }
148  
-        ul.sub-menu .menu-item a {
  142
+    ul.sub-menu {
  143
+        li.menu-item a {
149 144
             font-weight:normal;
150 145
             color:@grey;
151 146
             &:hover {color: @midpurple;}
152 147
             }
  148
+        li.current-menu-item a {
  149
+            font-weight:bold; 
  150
+            color:@darkpurple;
  151
+            &:hover {color:@darkpurple;}
  152
+            }
153 153
     }
154 154
     
155 155
     li:hover > ul.sub-menu {visibility:visible; display:block;}

No commit comments for this range

Something went wrong with that request. Please try again.