Skip to content

Commit 5495b5d

Browse files
committed
jquery.com: Added logo rotation for corporate members.
1 parent 731ca1c commit 5495b5d

File tree

2 files changed

+47
-14
lines changed

2 files changed

+47
-14
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
add_filter( 'the_content', function( $content ) {
4+
$memberPos = strpos( $content, '<!--corporate-members-->');
5+
if ( $memberPos === false ) {
6+
return $content;
7+
}
8+
9+
$members = json_decode( file_get_contents( GW_RESOURCE_DIR . '/corporate-members.json' ), true );
10+
shuffle( $members );
11+
12+
$memberContent = '<ul class="row" id="corporate-members">';
13+
foreach( $members as $index => $member ) {
14+
15+
// Only show four members at a time
16+
if ( $index >= 4 ) {
17+
break;
18+
}
19+
20+
$logoUrl = "//jquery.org/resources/members/" .
21+
preg_replace( '/[^a-z0-9]/', '', strtolower( $member[ 'name' ] ) ) . ".png";
22+
$memberContent .=
23+
'<li class="three columns">' .
24+
'<a href="' . $member[ 'url' ] . '">' .
25+
'<span></span>' .
26+
'<img src="' . $logoUrl . '">' .
27+
'</a>' .
28+
'</li>';
29+
}
30+
$memberContent .= '</ul>';
31+
32+
return str_replace( '<!--corporate-members-->', $memberContent, $content );
33+
} );
34+
35+
?>

themes/jquery.com/style.css

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,27 +130,25 @@ a,
130130
}
131131
}
132132

133-
#content #whos-using li {
133+
#content #corporate-members li {
134134
background: none;
135+
height: 150px;
135136
}
136137

137-
#whos-using li a {
138-
background: url('i/whos-using-sprite.png') 0px 0px no-repeat;
139-
display: block;
140-
height: 80px;
141-
text-indent: -9999px;
142-
}
143-
144-
#whos-using li a.mediatemple {
145-
background-position: 0 -80px;
138+
#corporate-members span {
139+
display: inline-block;
140+
height: 100%;
141+
vertical-align: middle;
146142
}
147143

148-
#whos-using li a.maxcdn {
149-
background-position: 0 -160px;
144+
#corporate-members a {
145+
float: left;
146+
height: 100%;
150147
}
151148

152-
#whos-using li a.wikipedia {
153-
background-position: 0 -240px;
149+
#corporate-members img {
150+
vertical-align: middle;
151+
max-height: 150px;
154152
}
155153

156154
/* Project Tiles */

0 commit comments

Comments
 (0)