Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: cam5/madisonclinic
base: b13f71d8a7
...
head fork: cam5/madisonclinic
compare: b8adb5cd64
Checking mergeability… Don't worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Oct 18, 2012
Cameron Media Function Fix
Shit's not clickable if it doesn't have extras!
b8adb5c
Showing with 40 additions and 24 deletions.
  1. +33 −17 functions.php
  2. +7 −7 less/styles.less
View
50 functions.php
@@ -86,9 +86,11 @@ function get_treatment_meta($post_id) {
function get_media_bricks() {
+ // Include the JS libs
echo '<script src="'.THEME_URI.'/js/jquery.masonry.min.js" type="text/javascript"></script>';
echo '<script src="'.THEME_URI.'/js/jquery.prettyPhoto.js" type="text/javascript"></script>';
+ // Get all mediaMentions
$bricks = new WP_Query(array(
'posts_per_page' => -1,
'post_type' => 'mediaMention'
@@ -98,14 +100,15 @@ function get_media_bricks() {
$bricky_doodle_doo = array();
$brick_media = array();
+ // For each mention
while ($bricks->have_posts()) {
$bricks->the_post();
$t = get_the_title();
$i = get_the_ID();
$m = get_post_meta($i);
- $m['_media_cover'] ? $cover = $m['_media_cover'] : $cover = null;
- $m['_media_addtl'] ? $addtl = $m['_media_addtl'] : $addtl = null;
+ $m['_media_cover'] ? $cover = $m['_media_cover'] : $cover = false;
+ $m['_media_addtl'] ? $addtl = $m['_media_addtl'] : $addtl = false;
$bricky_doodle_doo[$t] = array(
'cover' => $cover[0],
@@ -114,9 +117,12 @@ function get_media_bricks() {
}
foreach ($bricky_doodle_doo as $k => $media) {
+
$safe_title = preg_filter('/(\s)/', '_', $k);
- if (is_array($media['addtl'])) {
+ $link = ($media['addtl'][0] != '') ? true : false;
+
+ if ($link) {
foreach ($media['addtl'] as $number => $pic_path) {
$media['addtl'][$number] = "'".$pic_path."'";
@@ -124,23 +130,33 @@ function get_media_bricks() {
$gallery = implode(', ', $media['addtl']);
- }
- else $gallery = '';
+ }
+
+ $js = '';
+
+ if ($link) {
+ $js = "<script type='text/javascript'>"
+ .$safe_title."_gallery = [".$gallery."];"
+ .$safe_title."_titles = [];"
+ .$safe_title."_descriptions = [];"
+ ."</script>";
+ }
- echo "
- <script type='text/javascript'>
- ".$safe_title."_gallery = [".$gallery."];
- ".$safe_title."_titles = [];
- ".$safe_title."_descriptions = [];
- </script>
- <div class='box'>
- <a href='#' onclick='jQuery.prettyPhoto.open(".$safe_title."_gallery, ".$safe_title."_titles, ".$safe_title."_descriptions); return false'>
- <img src='" . $media['cover'] . "'>
- </a>
- </div>";
+ $output = "<div class='box'>";
+
+ if ($link)
+ $output .= "<a href='#' onclick='jQuery.prettyPhoto.open(".$safe_title."_gallery, ".$safe_title."_titles, ".$safe_title."_descriptions); return false'>";
+
+ $output .= "<img src='" . $media['cover'] . "'>";
+
+ if ($link)
+ $output .= "</a>";
+
+ $output .= "</div>";
+
+ echo $js.$output;
}
-
}
function thumbnail_src($id, $str) {
View
14 less/styles.less
@@ -139,17 +139,17 @@ p { .display(12px); }
a {color:@darkpurple; font-weight:bold }
}
- li.current-menu-parent {
- ul.sub-menu li.current-menu-item a {
- font-weight:bold;
- color:@darkpurple;
- &:hover {color:@darkpurple;}
- }
- ul.sub-menu .menu-item a {
+ ul.sub-menu {
+ li.menu-item a {
font-weight:normal;
color:@grey;
&:hover {color: @midpurple;}
}
+ li.current-menu-item a {
+ font-weight:bold;
+ color:@darkpurple;
+ &:hover {color:@darkpurple;}
+ }
}
li:hover > ul.sub-menu {visibility:visible; display:block;}

No commit comments for this range

Something went wrong with that request. Please try again.