Skip to content

Commit 9131422

Browse files
committed
blog.jquery.com: Sync sites.php entry and import blog.jquery.com theme
The version of this theme in this repo is practicaly empty and hasn't been used in a long time. When activating this locally via jquery-wp-docker, I noticed the settings don't match what we use in production. Import files from: https://github.com/jquery/blog.jquery.com-theme/tree/6710984735eb/jquery.com And refactor these slightly in order to work with the current version of the base theme. blog.jquery.com-theme/jquery/ * /header.php /footer-bottom.php /menu-header.php /page-fullwidth.php /searchform.php Minor differences, differed only in being a older but compatible version. Kept the newer ones here unchanged. (e.g. still mentioned Forum, IRC, and StackPath, and older search input field styling). * /functions.jquery.php This defined one extra function, jq_logo_link, which served as a workaround for missing some parts of jquery-wp-content by hardcoding `return '/'`, and already had a TODO for removing it when merging into jquery-wp-content. It was used in header.php, where we now use `get_option('jquery_logo_link', '/')` which works fine for the blog. * /comments.php Support for post_password_required is present at https://github.com/jquery/blog.jquery.com-theme but missing here. Given non-blog sites wouldn't use this it makes sense that it was absent. Cary this over as-is instead of figuring out whether we want or need it. It won't do anything on regular blog posts or an any non-blog sites. blog.jquery.com-theme/jquery.com/ * /functions.php: The body_class filter for class "listing" is already here as part of plugins/jquery-filters.php. The twentyeleven_comment (now jq_comment) function had logic for pingbanks. Import this code over so that (approved) pingbacks remain displayed among blog comments. * /category.php Identical to the one in the current "jquery" base theme, except for the heading "Category Archives" instead of "Category". This is presumably because API pages are considered posts in a category, and so the word "Archives" would be confusing there. Solve this by keeping the neutral "Category" that we have in the base theme and remove the forked veersion for that one word difference. * /content.php The only difference was the class "entry-posted" instead of "entry-meta" for the "posted on" date. This branch in the base theme is never used, so change it to the one the blog has. The entry-posted class is styled nearly the same as entry-meta except that in category/search listings we don't float "post on" to the right, whereas entry-meta categories are. * /single.php This is an override for blog posts. In order to share this neatly across the three blogs in the future, I've added this to the base theme as "single-blogpost.php" with a stub in blog.jquery.com/single.php that references this. This is akin to how we share templates for API sites with single-api.php. Additional CSS changes and fixes relating to blog posts: * Move text-shadow from `blockquote p` to `blockquote`. On our doc sites, HTML comes from Markdown parsers, which generally wrap text paragraphs. In WordPress, our blog posts are already stored in HTML, where there is generally not a paragraph wrapper within simple blockquotes. Fix our styles accomodate blog posts with blockquotes by applying this to the outer element. It should not affect any blockquotes that do for some reason have paragraphs in them, as they inherit the text-shadow just the same. Follows-up #454. * Fix broken `#comments-title` rule, lost to `#content h2`. Fix broken `.commentlist > li.bypostauthor` rule, lost to `#comments .commentlist > li.comment`. These were already broken on the blog, Bring these back in a more suble way (the original, if restored, was quite dark and imho hard to read), and strengthen the selector for now as-needed (one day, we'll get rid of these ID selectors...) * Remove unused `#reply-title` rule, lost in practice to `#content h3`, which seems fine as-is. * Remove unused `p.comment-form-comment` rule, lost in practice to `#respond p`, which looks fine. * Remove unused `.commentlist .children` rules. Unused for a long time since thread_comments=0 on all sites, including on the blogs. When thread_comment equals 0, it applies how old comment threads are rendered as well, so these truly are unused. * Remove unused `#cancel-comment-reply-link`, this is specific to WordPress's comment-reply.js, which we don't load. * Remove unused `.page-template-sidebar-page-php` rules. https://github.com/search?q=org%3Ajquery+pageTemplate+NOT+repo%3Ajquery%2Firc.jquery.org+NOT+repo%3Ajquery%2Fevents.jquery.org&type=code https://github.com/search?q=org%3Ajquery+%22sidebar-page.php%22+NOT+repo%3Ajquery%2Fblog.jquery.com-theme&type=code Ref jquery/infrastructure-puppet#17
1 parent f004bf9 commit 9131422

18 files changed

+327
-198
lines changed

plugins/jquery-actions.php

-10
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@
44
* Description: Default actions for all jQuery sites.
55
*/
66

7-
remove_action( 'wp_head', 'feed_links', 2 );
8-
remove_action( 'wp_head', 'feed_links_extra', 3 );
9-
remove_action( 'wp_head', 'rsd_link' );
10-
remove_action( 'wp_head', 'wlwmanifest_link' );
11-
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
12-
13-
// Remove shortlink <head> and header.
14-
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10 );
15-
remove_action( 'template_redirect', 'wp_shortlink_header', 11 );
16-
177
// Ensure relative links remain on the current protocol
188
// (such as references to theme assets and intra-site links).
199
// This does not influence 'home' and 'siteurl' options, and thus

plugins/jquery-filters.php

+15-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,21 @@
3131
}
3232
unset( $sites, $options, $option );
3333

34-
// Disable WordPress auto-paragraphing for posts.
35-
remove_filter( 'the_content', 'wpautop' );
34+
// Remove misc links from <head> on non-blog sites
35+
if ( !get_option( 'jquery_is_blog' ) ) {
36+
remove_action( 'wp_head', 'feed_links', 2 );
37+
remove_action( 'wp_head', 'feed_links_extra', 3 );
38+
remove_action( 'wp_head', 'rsd_link' );
39+
remove_action( 'wp_head', 'wlwmanifest_link' );
40+
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
41+
42+
// Remove shortlink <head> and header.
43+
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10 );
44+
remove_action( 'template_redirect', 'wp_shortlink_header', 11 );
45+
46+
// Disable WordPress auto-paragraphing for posts, except on actual blog sites
47+
remove_filter( 'the_content', 'wpautop' );
48+
}
3649

3750
// Disable WordPress text transformations (smart quotes, etc.) for posts.
3851
remove_filter( 'the_content', 'wptexturize' );

sites.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ function jquery_sites() {
2626
'blog_id' => 2,
2727
'cookie_domain' => '.jquery.com',
2828
'options' => array(
29-
'blogname' => 'jQuery Blog',
30-
'stylesheet' => 'blog-jquery-com',
31-
// 'permalink_structure' => '/%category%/%postname%/',
29+
'blogname' => 'Official jQuery Blog',
30+
'blogdescription' => 'New Wave JavaScript',
31+
'jquery_author' => 'jQuery Team - jquery.com',
32+
'jquery_description' => 'jQuery: The Write Less, Do More, JavaScript Library',
33+
'stylesheet' => 'blog.jquery.com',
3234
'jquery_body_class' => 'jquery',
35+
'permalink_structure' => '/%year%/%monthnum%/%day%/%postname%/',
36+
'jquery_is_blog' => true,
3337
),
3438
),
3539
'api.jquery.com' => array(
@@ -395,10 +399,11 @@ function jquery_default_site_options() {
395399
'blogdescription' => '',
396400
'permalink_structure' => '/%postname%/',
397401
'use_smilies' => 0,
402+
398403
// The one site where comments are sometimes enabled (blog.jquery.com)
399404
// has always had thread_comments turned off.
400405
//
401-
// Oher sites like api.jquery.com implement their pages as posts,
406+
// Other sites like api.jquery.com implement their pages as posts,
402407
// but naturally don't support comments at all. Turn this off to
403408
// remove the WordPress comment-reply script from pages by default.
404409
'thread_comments' => 0,

themes/blog.jquery.com/sidebar.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<div id="sidebar" class="widget-area" role="complementary">
2+
<aside class="widget">
3+
<h3 class="widget-title">Categories</h3>
4+
<ul>
5+
<?php wp_list_categories(array(
6+
'depth' => 1,
7+
'title_li' => '',
8+
'exclude' => '1'
9+
)); ?>
10+
</ul>
11+
</aside>
12+
<aside class="widget">
13+
<h3 class="widget-title">Recent Posts</h3>
14+
<ul>
15+
<?php
16+
$recent_posts = wp_get_recent_posts(array(
17+
'post_status' => 'publish'
18+
));
19+
foreach( $recent_posts as $recent ){
20+
echo '<li><a href="' . get_permalink($recent["ID"]) . '">' . $recent["post_title"].'</a></li>';
21+
}
22+
?>
23+
</ul>
24+
</aside>
25+
<aside class="widget">
26+
<h3 class="widget-title">Archives</h3>
27+
<ul>
28+
<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
29+
</ul>
30+
</aside>
31+
</div>

themes/blog.jquery.com/single.php

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
get_template_part( 'single', 'blogpost' );

themes/blog.jquery.com/style.css

+165
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,168 @@
22
Theme Name: blog-jquery-com
33
Template: jquery
44
*/
5+
6+
a,
7+
.title {
8+
color: #b24926;
9+
}
10+
#content a:hover {
11+
color: #333;
12+
}
13+
14+
.assistive-text,
15+
.screen-reader-text {
16+
position: absolute !important;
17+
clip: rect(1px, 1px, 1px, 1px);
18+
overflow: hidden;
19+
height: 1px;
20+
width: 1px;
21+
}
22+
23+
/* Copied from blog.jquery.com-theme.git:/jquery/css/blog.css */
24+
25+
.alignright {
26+
float: right;
27+
}
28+
.alignleft {
29+
float: left;
30+
}
31+
32+
.entry-posted {
33+
color: #999;
34+
font-size: 12px;
35+
}
36+
37+
/* =Comments
38+
----------------------------------------------- */
39+
40+
#comments-title,
41+
#content h2#comments-title {
42+
margin-top: 2.6em;
43+
text-transform: uppercase;
44+
}
45+
.nopassword,
46+
.nocomments {
47+
font-size: 24px;
48+
font-weight: 100;
49+
margin: 26px 0;
50+
}
51+
.commentlist {
52+
list-style: none;
53+
margin: 0 auto;
54+
}
55+
.content .commentlist {
56+
width: 100%; /* reset the width for the one-column layout */
57+
}
58+
#comments .commentlist > li.comment {
59+
background: #f6f6f6;
60+
border: 1px solid #ddd;
61+
border-radius: 3px;
62+
margin: 0 0 1em 60px;
63+
padding: 5px 12px 0;
64+
position: relative;
65+
word-wrap: break-word;
66+
}
67+
#comments .commentlist > li.pingback {
68+
margin: 0 0 1em 60px;
69+
padding: 0 1.625em;
70+
}
71+
.comment-meta .fn {
72+
font-style: normal;
73+
font-weight: bold;
74+
}
75+
.comment-meta {
76+
color: #666;
77+
font-size: 12px;
78+
line-height: 2.2em;
79+
}
80+
/* Post author highlighting */
81+
#comments .commentlist > li.bypostauthor {
82+
border-color: #0769ad; /* jQuery Primary Blue */
83+
}
84+
#comments .commentlist > li.bypostauthor .comment-meta {
85+
background: #ddd;
86+
border-radius: 3px 3px 0 0;
87+
color: inherit;
88+
margin: -5px -12px 5px -12px;
89+
padding: 5px 12px;
90+
}
91+
.commentlist .avatar {
92+
border-radius: 3px;
93+
box-shadow: 0 1px 2px #ccc;
94+
left: -82px;
95+
padding: 0;
96+
position: absolute;
97+
top: 0;
98+
}
99+
a.comment-reply-link {
100+
background: #eee;
101+
border-radius: 3px;
102+
color: #666;
103+
display: inline-block;
104+
font-size: 12px;
105+
padding: 0 8px;
106+
text-decoration: none;
107+
}
108+
a.comment-reply-link:hover,
109+
a.comment-reply-link:focus,
110+
a.comment-reply-link:active {
111+
background: #888;
112+
color: #fff;
113+
}
114+
a.comment-reply-link > span {
115+
display: inline-block;
116+
position: relative;
117+
top: -1px;
118+
}
119+
120+
/* Comment Form */
121+
#respond {
122+
background: #f6f6f6;
123+
border: 1px solid #ddd;
124+
border-radius: 3px;
125+
margin: 0 0 1.625em;
126+
padding: 1.625em;
127+
}
128+
#respond form {
129+
padding: 0;
130+
}
131+
#respond p {
132+
margin: 10px 0;
133+
}
134+
#respond .comment-notes,
135+
#respond .logged-in-as,
136+
#respond label {
137+
font-size: 12px;
138+
}
139+
#respond label {
140+
line-height: 2.2em;
141+
}
142+
#respond .comment-form-comment label {
143+
display: block;
144+
}
145+
#respond .required {
146+
color: #bd3500;
147+
font-weight: bold;
148+
}
149+
#respond input[type="text"],
150+
#respond textarea {
151+
background: #fff;
152+
border-radius: 5px;
153+
padding: 10px;
154+
}
155+
#respond textarea {
156+
resize: vertical;
157+
width: 95%;
158+
}
159+
#respond input[type=text] {
160+
display: block;
161+
height: 24px;
162+
width: 75%;
163+
}
164+
#respond .form-submit {
165+
text-align: right;
166+
}
167+
#respond input[type=submit] {
168+
float: none;
169+
}

themes/jquery/archive.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<?php _e( 'Blog Archives', 'twentyeleven' ); ?>
1717
<?php endif; ?>
1818
</h1>
19-
<hr class="dots">
19+
<hr>
2020
</header>
2121

2222
<?php

themes/jquery/author.php

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<h1 class="page-title author"><?php
2424
printf( __( 'Author Archives: %s', 'twentyeleven' ), get_the_author() );
2525
?></h1>
26+
<hr>
2627
</header>
2728

2829
<?php

themes/jquery/comments.php

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<div id="comments">
2+
<?php if ( post_password_required() ) : ?>
3+
<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyeleven' ); ?></p>
4+
</div><!-- #comments -->
5+
<?php
6+
// Skip the rest of comments.php.
7+
return;
8+
endif;
9+
?>
210
<?php if ( have_comments() ) : ?>
311
<h2 id="comments-title">
412
<?php
@@ -8,10 +16,11 @@
816
</h2>
917

1018
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
11-
<nav id="comment-nav-above">
19+
<nav class="pagination">
1220
<h1 class="assistive-text"><?php _e( 'Comment navigation', 'twentyeleven' ); ?></h1>
13-
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?></div>
14-
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?></div>
21+
<?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?>
22+
<?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?>
23+
<hr>
1524
</nav>
1625
<?php endif; ?>
1726

@@ -20,10 +29,9 @@
2029
</ol>
2130

2231
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
23-
<nav id="comment-nav-below">
24-
<h1 class="assistive-text"><?php _e( 'Comment navigation', 'twentyeleven' ); ?></h1>
25-
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?></div>
26-
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?></div>
32+
<nav class="pagination">
33+
<?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?>
34+
<?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?>
2735
</nav>
2836
<?php endif; // check for comment navigation ?>
2937

@@ -37,4 +45,4 @@
3745
<?php endif; ?>
3846

3947
<?php comment_form(); ?>
40-
</div>
48+
</div>

themes/jquery/content.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@
2626
<?php endif; ?>
2727

2828
<?php if ( 'post' == get_post_type() ) : ?>
29-
<div class="entry-meta">
29+
<div class="entry-posted">
3030
<?php jq_posted_on(); ?>
3131
</div>
3232
<?php endif; ?>
3333
</header>
3434

35-
<?php if ( is_search() ) : // Only display Excerpts for Search ?>
35+
<?php
36+
// Show excerpt in search, archives (year, author, category), and non-latest items on blog homepage
37+
if ( ( is_home() && get_next_post_link() ) || is_archive() || is_search() ) :
38+
?>
3639
<div class="entry-summary">
3740
<?php the_excerpt(); ?>
3841
</div>

0 commit comments

Comments
 (0)