Skip to content

Commit 4805dfb

Browse files
author
Cosmin
committed
blog redesign initial commit ( needs testing )
1 parent fbd2578 commit 4805dfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+5323
-475
lines changed

archive.php

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,40 @@
88
*/
99
get_header(); ?>
1010
<?php $layout_class = ( function_exists( 'shapely_get_layout_class' ) ) ? shapely_get_layout_class() : ''; ?>
11-
<div id="primary" class="col-md-9 mb-xs-24 <?php echo esc_attr( $layout_class ); ?>"><?php
12-
if ( have_posts() ) :
13-
14-
if ( is_home() && ! is_front_page() ) : ?>
15-
<header>
16-
<h1 class="page-title screen-reader-text"><?php esc_html( single_post_title() ); ?></h1>
17-
</header>
18-
19-
<?php
20-
endif;
21-
22-
/* Start the Loop */
23-
while ( have_posts() ) : the_post();
24-
25-
/*
26-
* Include the Post-Format-specific template for the content.
27-
* If you want to override this in a child theme, then include a file
28-
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
29-
*/
30-
get_template_part( 'template-parts/content', get_post_format() );
31-
32-
endwhile;
33-
34-
if ( function_exists( "shapely_pagination" ) ):
35-
shapely_pagination();
36-
endif;
37-
38-
else :
39-
40-
get_template_part( 'template-parts/content', 'none' );
41-
11+
<div class="row">
12+
<?php
13+
if ( $layout_class == 'sidebar-left' ):
14+
get_sidebar();
15+
endif;
16+
?>
17+
<div id="primary" class="col-md-8 mb-xs-24 <?php echo esc_attr( $layout_class ); ?>"><?php
18+
if ( have_posts() ) :
19+
20+
if ( is_home() && ! is_front_page() ) : ?>
21+
<header>
22+
<h1 class="page-title screen-reader-text"><?php esc_html( single_post_title() ); ?></h1>
23+
</header>
24+
25+
<?php
26+
endif;
27+
28+
$layout_type = get_theme_mod( 'blog_layout_view', 'grid' );
29+
30+
get_template_part( 'template-parts/layouts/blog', $layout_type );
31+
32+
if ( function_exists( "shapely_pagination" ) ):
33+
shapely_pagination();
34+
endif;
35+
36+
else :
37+
get_template_part( 'template-parts/content', 'none' );
38+
39+
endif; ?>
40+
</div><!-- #primary -->
41+
<?php
42+
if ( $layout_class == 'sidebar-right' ):
43+
get_sidebar();
4244
endif; ?>
43-
</div><!-- #primary -->
45+
</div>
4446
<?php
45-
get_sidebar();
4647
get_footer();

assets/images/placeholder.jpg

15.5 KB
Loading

assets/images/placeholder_wide.jpg

15.3 KB
Loading

comments.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
?>
2222

2323
<div id="comments" class="comments-area comments nolist">
24-
2524
<?php
2625
// You can start editing here -- including this comment!
2726
if ( have_comments() ) : ?>
@@ -45,11 +44,11 @@
4544
</div><!-- .nav-links -->
4645
</nav><!-- #comment-nav-above -->
4746
<?php endif; // Check for comment navigation. ?>
48-
47+
4948
<?php add_filter('comment_reply_link', 'shapely_reply_link_class'); ?>
5049
<ul class="comments-list">
5150
<?php
52-
wp_list_comments( array(
51+
wp_list_comments( array(
5352
'style' => 'ol',
5453
'short_ping' => true,
5554
'avatar_size'=> 75,
@@ -82,7 +81,7 @@
8281
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'shapely' ); ?></p>
8382
<?php
8483
endif;
85-
84+
8685
/* comment form */
8786
$comments_args = ( function_exists( 'shapely_custom_comment_form' ) ) ? shapely_custom_comment_form() : '';
8887
comment_form($comments_args);

footer.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
?>
1313

14-
</div><!-- row -->
1514
</div><!-- #main -->
1615
</section><!-- section -->
1716

1817
<div class="footer-callout">
1918
<?php shapely_footer_callout(); ?>
2019
</div>
20+
2121
<footer id="colophon" class="site-footer footer bg-dark" role="contentinfo">
2222
<div class="container footer-inner">
2323
<div class="row">
@@ -26,9 +26,12 @@
2626

2727
<div class="row">
2828
<div class="site-info col-sm-6">
29-
<div
30-
class="copyright-text"><?php echo wp_kses_post( get_theme_mod( 'shapely_footer_copyright' ) ); ?></div>
31-
<div class="footer-credits"><?php shapely_footer_info(); ?></div>
29+
<div class="copyright-text">
30+
<?php echo wp_kses_post( get_theme_mod( 'shapely_footer_copyright' ) ); ?>
31+
</div>
32+
<div class="footer-credits">
33+
<?php shapely_footer_info(); ?>
34+
</div>
3235
</div><!-- .site-info -->
3336
<div class="col-sm-6 text-right">
3437
<?php shapely_social_icons(); ?>
@@ -44,4 +47,4 @@ class="copyright-text"><?php echo wp_kses_post( get_theme_mod( 'shapely_footer_c
4447
<?php wp_footer(); ?>
4548

4649
</body>
47-
</html>
50+
</html>

functions.php

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ function shapely_setup() {
3636
'flex-width' => true,
3737
) );
3838

39+
add_theme_support( 'custom-header', apply_filters( 'shapely_custom_header_args', array(
40+
'default-image' => '',
41+
'default-text-color' => '000000',
42+
'width' => 1900,
43+
'height' => 225,
44+
'flex-width' => true
45+
) ) );
46+
3947
/*
4048
* Let WordPress manage the document title.
4149
* By adding theme support, we declare that this theme does not use a
@@ -81,8 +89,9 @@ function shapely_setup() {
8189
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
8290
*/
8391
add_theme_support( 'post-thumbnails' );
84-
85-
add_image_size( 'shapely-featured', 848, 566, true );
92+
add_image_size( 'shapely-full', 1110, 530, true );
93+
add_image_size( 'shapely-featured', 730, 350, true );
94+
add_image_size( 'shapely-grid', 350, 300, true );
8695

8796
add_theme_support( 'customize-selective-refresh-widgets' );
8897
// Welcome screen
@@ -193,6 +202,27 @@ function shapely_widgets_init() {
193202

194203
add_action( 'widgets_init', 'shapely_widgets_init' );
195204

205+
/**
206+
* Hides the custom post template for pages on WordPress 4.6 and older
207+
*
208+
* @param array $post_templates Array of page templates. Keys are filenames, values are translated names.
209+
*
210+
* @return array Filtered array of page templates.
211+
*/
212+
function shapely_exclude_page_templates( $post_templates ) {
213+
214+
if ( version_compare( $GLOBALS['wp_version'], '4.7', '<' ) ) {
215+
unset( $post_templates['page-templates/full-width.php'] );
216+
unset( $post_templates['page-templates/no-sidebar.php'] );
217+
unset( $post_templates['page-templates/sidebar-left.php'] );
218+
unset( $post_templates['page-templates/sidebar-right.php'] );
219+
}
220+
221+
return $post_templates;
222+
}
223+
224+
add_filter( 'theme_page_templates', 'shapely_exclude_page_templates' );
225+
196226
/**
197227
* Enqueue scripts and styles.
198228
*/
@@ -232,17 +262,20 @@ function shapely_scripts() {
232262
if ( is_page_template( 'template-home.php' ) ) {
233263
wp_enqueue_script( 'shapely-parallax', get_template_directory_uri() . '/js/parallax.min.js', array( 'jquery' ), '20160115', true );
234264
}
265+
/**
266+
* OwlCarousel Library
267+
*/
268+
wp_enqueue_script( 'owl.carousel', get_template_directory_uri() . '/js/owl-carousel/owl.carousel.min.js', array( 'jquery' ), '20160115', true );
269+
wp_enqueue_style( 'owl.carousel', get_template_directory_uri() . '/js/owl-carousel/owl.carousel.min.css' );
270+
wp_enqueue_style( 'owl.carousel', get_template_directory_uri() . '/js/owl-carousel/owl.theme.default.css' );
235271

236272
wp_enqueue_script( 'shapely-scripts', get_template_directory_uri() . '/js/shapely-scripts.js', array( 'jquery' ), '20160115', true );
273+
274+
wp_enqueue_style( 'shapely-scss', get_template_directory_uri() . '/assets/css/style.css' );
237275
}
238276

239277
add_action( 'wp_enqueue_scripts', 'shapely_scripts' );
240278

241-
/**
242-
* Implement the Custom Header feature.
243-
*/
244-
require get_template_directory() . '/inc/custom-header.php';
245-
246279
/**
247280
* Custom template tags for this theme.
248281
*/
@@ -274,9 +307,9 @@ function shapely_scripts() {
274307
require get_template_directory() . '/inc/socialnav.php';
275308

276309
/**
277-
* Load Metboxes
310+
* Load related posts
278311
*/
279-
require get_template_directory() . '/inc/metaboxes.php';
312+
require get_template_directory() . '/inc/class-shapely-related-posts.php';
280313

281314
/**
282315
* Load the system checks ( used for notifications )

header.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<?php shapely_top_callout(); ?>
6363
</div>
6464
<?php endif; ?>
65+
6566
<section class="content-area <?php echo ( get_theme_mod( 'top_callout', true ) ) ? '' : ' pt0 ' ?>">
6667
<div id="main" class="<?php echo ( ! is_page_template( 'template-home.php' ) ) ? 'container' : ''; ?>"
67-
role="main">
68-
<div class="row">
68+
role="main">

inc/admin/welcome-screen/notify-system-checks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static function shapely_check_plugin_is_active( $slug ) {
9999
}
100100

101101
if ( file_exists( $path ) ) {
102-
include_once( ABSPATH . WPINC . '/plugin.php' );
102+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
103103

104104
return is_plugin_active( $slug . '/' . $slug2 . '.php' );
105105
}

inc/admin/welcome-screen/welcome-screen.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public function check_active( $slug ) {
250250
}
251251

252252
if ( file_exists( $path ) ) {
253-
include_once( ABSPATH . WPINC . '/plugin.php' );
253+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
254254

255255
$needs = is_plugin_active( $slug . '/' . $slug2 . '.php' ) ? 'deactivate' : 'activate';
256256

0 commit comments

Comments
 (0)