Skip to content

Commit d78aa28

Browse files
authored
Merge pull request #56 from OpenSourceOrg/merge/blog-import-to-main
Merge/blog import to main
2 parents 2c11001 + 54ad6ba commit d78aa28

16 files changed

Lines changed: 395 additions & 112 deletions

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

themes/osi/assets/scss/_6_components.content.scss

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ p, h1, h2, h3, h4, h5, h6, blockquote, ol, ul, dl, address {
3535

3636
.single-post .cover--header {
3737
&.no-thumbnail {
38-
min-height: 430px;
38+
min-height: 305px;
3939
}
4040
}
4141

@@ -211,3 +211,94 @@ p, h1, h2, h3, h4, h5, h6, blockquote, ol, ul, dl, address {
211211
.post--content {
212212
margin-bottom: 20px;
213213
}
214+
.blog {
215+
.content .content-full .content--page {
216+
max-width: 1250px;
217+
}
218+
.post-archive-wrap {
219+
width:100%;
220+
221+
p:last-of-type {
222+
margin-bottom: 0;
223+
}
224+
.wp-block-column h2 {
225+
margin-top: 20px;
226+
}
227+
}
228+
.sidebar.content--sidebar {
229+
width:100%;
230+
font-size: 14px;
231+
}
232+
article.first-post {
233+
.osi-list--image img {
234+
width: 100%;
235+
margin-top: 40px;
236+
}
237+
.osi-list--post-content {
238+
width: 100%;
239+
background-color: #f7f7f7;
240+
padding: 32px;
241+
242+
p:last-of-type {
243+
margin-bottom: 0;
244+
}
245+
}
246+
}
247+
.entry-meta.post--byline a {
248+
color: #767676;
249+
font-size: clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.217), 16px);
250+
}
251+
.sidebar .has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-meta {
252+
margin: 0;
253+
}
254+
.sidebar ol.wp-block-latest-comments {
255+
padding: 0;
256+
}
257+
.sidebar .wp-block-latest-posts__post-title {
258+
font-size: 16px;
259+
}
260+
.special-sep {
261+
margin: 100px 0;
262+
}
263+
.special-sep:after {
264+
content: '';
265+
left: calc(50% - 80px / 2);
266+
width: 80px;
267+
content: '';
268+
position: absolute;
269+
height: 40px;
270+
top: -20px;
271+
background: #FFFFFF url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNi4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4yIiBiYXNlUHJvZmlsZT0idGlueSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiDQoJIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjU2IDI0OCIgb3ZlcmZsb3c9InZpc2libGUiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGc+DQoJPHBhdGggZmlsbD0ibm9uZSIgZD0iTTE0My4zLDE2Ny44YzIyLjEtOC41LDMzLjEtMzMuMiwyNC42LTU1LjNjLTguNS0yMi4xLTMzLjItMzMuMS01NS4zLTI0LjZjLTIyLjEsOC41LTMzLjEsMzMuMi0yNC42LDU1LjMNCgkJYzQuMywxMS4zLDEzLjMsMjAuMywyNC42LDI0LjZMODMuOCwyNDNjLTYzLjUtMjQuNC05NS4zLTk1LjctNzAuOS0xNTkuM3M5NS43LTk1LjMsMTU5LjItNzAuOXM5NS4zLDk1LjcsNzAuOSwxNTkuMw0KCQljLTEyLjUsMzIuNi0zOC4zLDU4LjQtNzAuOSw3MC45TDE0My4zLDE2Ny44Ii8+DQoJPHBhdGggZmlsbD0iIzIzMUYyMCIgZD0iTTE3Mi4yLDI0Ny40Yy0wLjYsMC0xLjItMC4xLTEuOC0wLjRjLTEuMS0wLjUtMS45LTEuN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wLjZjMSwwLjUsMS41LDEuNCwxLjUsMi43YzAsMC45LTAuMywxLjYtMC44LDJjLTAuNSwwLjQtMS4yLDAuNy0xLjksMC43YzAuNywwLjEsMS4yLDAuNCwxLjYsMC42DQoJCWMwLjcsMC41LDEsMS40LDEsMi41djFjMCwwLjEsMCwwLjIsMCwwLjNzMCwwLjIsMC4xLDAuM2wwLjEsMC4zaC0yLjhjLTAuMS0wLjQtMC4xLTAuOS0wLjItMS41cy0wLjEtMS4xLTAuMi0xLjQNCgkJYy0wLjEtMC40LTAuNC0wLjctMC44LTAuOGMtMC4yLTAuMS0wLjUtMC4xLTEtMC4ybC0wLjYsMGgtMC42djMuOUgyMzkuMnoiLz4NCjwvZz4NCjwvc3ZnPg0K) no-repeat center;
272+
}
273+
}
274+
275+
@media (min-width: 1000px) {
276+
.blog {
277+
article.first-post {
278+
display: flex;
279+
flex-wrap: nowrap !important;
280+
281+
.osi-list--image {
282+
flex-basis: 60%;
283+
flex-grow: 0;
284+
}
285+
.osi-list--post-content {
286+
flex-basis: 52%;
287+
flex-grow: 0;
288+
align-self: center;
289+
position: relative;
290+
z-index: 9;
291+
margin-left: -64px;
292+
}
293+
}
294+
.sidebar.content--sidebar {
295+
display:inline-block;
296+
width:18%;
297+
padding-left: 20px;
298+
}
299+
.post-archive-wrap {
300+
display:inline-block;
301+
width:80%;
302+
}
303+
}
304+
}

themes/osi/comments.php

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -22,56 +22,6 @@
2222

2323
<div id="comments" class="comments comments-area">
2424

25-
<?php
26-
// You can start editing here -- including this comment!
27-
if ( have_comments() ) :
28-
?>
29-
<h3 class="comments--title">
30-
<?php
31-
$comment_count = get_comments_number();
32-
if ( 1 === $comment_count ) {
33-
printf(
34-
/* translators: 1: title. */
35-
esc_html_e( 'One thought on &ldquo;%1$s&rdquo;', 'osi' ),
36-
'<span>' . esc_html( get_the_title() ) . '</span>'
37-
);
38-
} else {
39-
printf( // phpcs:ignore
40-
/* translators: 1: comment count number, 2: title. */
41-
esc_html( _nx( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', $comment_count, 'comments title', 'osi' ) ),
42-
esc_html( number_format_i18n( $comment_count ) ),
43-
'<span>' . esc_html( get_the_title() ) . '</span>'
44-
);
45-
}
46-
?>
47-
</h2><!-- .comments-title -->
48-
49-
<?php the_comments_navigation(); ?>
50-
51-
<ol class="comments--list">
52-
<?php
53-
wp_list_comments(
54-
array(
55-
'style' => 'ol',
56-
'short_ping' => true,
57-
)
58-
);
59-
?>
60-
</ol><!-- .comment-list -->
61-
62-
<?php
63-
the_comments_navigation();
64-
65-
// If comments are closed and there are comments, let's leave a little note, shall we?
66-
if ( ! comments_open() ) :
67-
?>
68-
<p class="no-comments alert alert-warning"><?php esc_html_e( 'Comments are closed.', 'osi' ); ?></p>
69-
<?php
70-
endif;
71-
72-
endif; // Check for have_comments().
73-
74-
comment_form();
75-
?>
25+
<?php comment_form(); ?>
7626

7727
</div><!-- #comments -->

themes/osi/footer.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
/**
33
* The template for displaying the footer
44
*
5-
*
65
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
76
*
87
* @package osi
98
*/
109

1110
$footerclass = is_active_sidebar( 'sidebar-footer' ) ? 'widgetized-footer footer--widgets' : 'standard-footer';
11+
if ( is_blog() ) :
12+
get_template_part( 'template-parts/email-block' );
13+
endif;
1214
?>
1315

1416
<footer id="colophon" class="footer site-footer" role="contentinfo">
@@ -52,4 +54,4 @@
5254
<?php wp_footer(); ?>
5355

5456
</body>
55-
</html>
57+
</html>

themes/osi/functions.php

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Note that this function is hooked into the after_setup_theme hook, which
1515
* runs before the init hook. The init hook is too late for some features, such
1616
* as indicating support for post thumbnails.
17+
*
18+
* @return void
1719
*/
1820
function osi_setup() {
1921
/*
@@ -114,6 +116,8 @@ function osi_setup() {
114116

115117
/**
116118
* Register sidebars and widgets
119+
*
120+
* @return void
117121
*/
118122
function osi_widgets_init() {
119123
// Sidebars
@@ -168,7 +172,8 @@ function osi_widgets_init() {
168172
*
169173
* Priority 0 to make it available to lower priority callbacks.
170174
*
171-
* @global int $content_width
175+
* @global int $content_width Content width to set.
176+
* @return void
172177
*/
173178
function osi_content_width() {
174179
$GLOBALS['content_width'] = apply_filters( 'osi_content_width', 640 );
@@ -177,6 +182,8 @@ function osi_content_width() {
177182

178183
/**
179184
* Add a reusable block admin menu link for easy administration.
185+
*
186+
* @return void
180187
*/
181188
function osi_reusable_blocks_admin_menu(): void {
182189
add_theme_page(
@@ -192,6 +199,8 @@ function osi_reusable_blocks_admin_menu(): void {
192199

193200
/**
194201
* Enqueue scripts and styles.
202+
*
203+
* @return void
195204
*/
196205
function osi_scripts() {
197206
wp_enqueue_style(
@@ -226,7 +235,11 @@ function osi_scripts() {
226235
}
227236
add_action( 'wp_enqueue_scripts', 'osi_scripts' );
228237

229-
/** Frontend Inline Styles **/
238+
/**
239+
* Add inline styles to the frontend.
240+
*
241+
* @return void
242+
*/
230243
function osi_inline_styles() {
231244
wp_add_inline_style( 'osi-style', osi_palette_css() );
232245
wp_add_inline_style( 'osi-style', osi_gradient_css() );
@@ -235,7 +248,11 @@ function osi_inline_styles() {
235248
}
236249
add_action( 'wp_enqueue_scripts', 'osi_inline_styles', 100 ); // prioritize as last
237250

238-
/** Block Editor Styles **/
251+
/**
252+
* Add block editor assets.
253+
*
254+
* @return void
255+
*/
239256
function osi_add_block_editor_assets() {
240257
wp_enqueue_style( 'editor-styles', get_template_directory_uri() . '/assets/css/editor-style.css', '', 1 );
241258
wp_add_inline_style( 'editor-styles', osi_palette_css() );
@@ -316,9 +333,11 @@ function osi_add_block_editor_assets() {
316333

317334
/**
318335
* Register the "Footer - Above credits" sidebar.
336+
*
337+
* @return void
319338
*/
320339
function register_footer_above_sidebar() {
321-
register_sidebar(
340+
register_sidebar(
322341
array(
323342
'name' => esc_html__( 'Footer - Above Credits', 'osi' ),
324343
'id' => 'footer-above-credits',
@@ -327,7 +346,51 @@ function register_footer_above_sidebar() {
327346
'after_widget' => '</div>',
328347
'before_title' => '<h2 class="widget-title">',
329348
'after_title' => '</h2>',
330-
)
349+
)
331350
);
332351
}
333-
add_action('widgets_init', 'register_footer_above_sidebar');
352+
add_action( 'widgets_init', 'register_footer_above_sidebar' );
353+
354+
/**
355+
* Adjust the 'blog' (post archive) to show a different number of posts on the first page.
356+
*
357+
* @param WP_Query $query WordPress Query object.
358+
*
359+
* @return void
360+
*/
361+
function osi_query_offset( WP_Query &$query ) {
362+
if ( ! ( $query->is_blog() || is_main_query() ) || is_admin() || is_front_page() || is_archive() || is_404() ) {
363+
return;
364+
}
365+
366+
$offset = -1;
367+
$ppp = get_option( 'posts_per_page' );
368+
369+
if ( $query->is_paged ) {
370+
// Manually determine page query offset (offset + current page (minus one) x posts per page)
371+
$page_offset = $offset + ( ( $query->query_vars['paged'] - 1 ) * $ppp );
372+
// Apply adjust page offset
373+
$query->set( 'offset', $page_offset );
374+
} else {
375+
// This is the first page. Set a different number for posts per page
376+
$query->set( 'posts_per_page', $offset + $ppp );
377+
}
378+
}
379+
add_action( 'pre_get_posts', 'osi_query_offset', 1 );
380+
381+
/**
382+
* Adjust the pagination offset.
383+
*
384+
* @param integer $found_posts The number of found posts.
385+
* @param WP_Query $query WordPress Query object.
386+
*
387+
* @return integer Adjusted number of found posts.
388+
*/
389+
function osi_adjust_offset_pagination( int $found_posts, WP_Query $query ) {
390+
$offset = -1;
391+
if ( $query->is_blog() && is_main_query() && ! is_admin() && ! $query->is_front_page() ) {
392+
return $found_posts - $offset;
393+
}
394+
return $found_posts;
395+
}
396+
add_filter( 'found_posts', 'osi_adjust_offset_pagination', 1, 2 );

themes/osi/inc/config.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,7 @@ function osi_excerpt_length( $length ) {
7878
}
7979

8080
function osi_excerpt_more( $more ) {
81-
82-
if ( is_post_type_archive( sugar_calendar_get_event_post_type_id() ) ) {
8381
return '...';
84-
}
85-
86-
return '... <a class="read-more" href="' . get_permalink( get_the_ID() ) . '">' . __( 'Read More', 'osi' ) . '</a>';
8782
}
8883
add_filter( 'excerpt_length', 'osi_excerpt_length' );
8984
add_filter( 'excerpt_more', 'osi_excerpt_more' );

0 commit comments

Comments
 (0)