Skip to content

Commit 35c44ea

Browse files
author
Cosmin
authored
Merge pull request #12 from c0sm1n87/master
blog redesign
2 parents d1291f7 + 4805dfb commit 35c44ea

Some content is hidden

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

50 files changed

+5458
-603
lines changed

archive.php

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,46 @@
22
/**
33
* The template for displaying archive pages.
44
*
5-
* @link https://codex.wordpress.org/Template_Hierarchy
5+
* @link https://codex.wordpress.org/Template_Hierarchy
66
*
77
* @package Shapely
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 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

changelog.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
### 1.7.1
2+
<a href="https://github.com/puikinsh/shapely/issues">Issues</a>
3+
#112 - #1 - there's nothing wrong in using abspath, it's a WordPress core define, nothing added by the theme/plugin. Changed it to incorporate MU
4+
- #2 - removed from global scope
5+
- #3 - removed custom sanitize for hex
6+
- #4 - removed shapely_sanitize_strip_slashes
7+
- #5 - escaped variable
8+
- #6 - I don't think Colorlib and WordPress are translatable
9+
- #7 - escaped where needed
10+
- #8 - removed registration of menu from socialnav.php
11+
- #9 - removed theme support for post formats
12+
- #10 - escaped where needed
13+
- #11 - translated
14+
- #12 - escaped where needed
15+
116
### 1.7.0
217
<a href="https://github.com/puikinsh/shapely/issues">Issues</a>
318
#79 - restyled <q> a little bit ( added a bg, set font style to italic )

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: 58 additions & 44 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
@@ -53,7 +61,8 @@ function shapely_setup() {
5361

5462
// This theme uses wp_nav_menu() in one location.
5563
register_nav_menus( array(
56-
'primary' => esc_html__( 'Primary', 'shapely' ),
64+
'primary' => esc_html__( 'Primary', 'shapely' ),
65+
'social-menu' => esc_html__( 'Social Menu', 'shapely' ),
5766
) );
5867

5968
/*
@@ -68,18 +77,6 @@ function shapely_setup() {
6877
'caption',
6978
) );
7079

71-
/*
72-
* Enable support for Post Formats.
73-
* See https://developer.wordpress.org/themes/functionality/post-formats/
74-
*/
75-
add_theme_support( 'post-formats', array(
76-
'aside',
77-
'image',
78-
'video',
79-
'quote',
80-
'link',
81-
) );
82-
8380
// Set up the WordPress core custom background feature.
8481
add_theme_support( 'custom-background', apply_filters( 'shapely_custom_background_args', array(
8582
'default-color' => 'ffffff',
@@ -92,16 +89,18 @@ function shapely_setup() {
9289
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
9390
*/
9491
add_theme_support( 'post-thumbnails' );
95-
96-
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 );
9795

9896
add_theme_support( 'customize-selective-refresh-widgets' );
9997
// Welcome screen
10098
if ( is_admin() ) {
10199
global $shapely_required_actions, $shapely_recommended_plugins;
102100

103101
$shapely_recommended_plugins = array(
104-
'fancybox-for-wordpress' => array( 'recommended' => false )
102+
'wordpress-seo' => array( 'recommended' => true ),
103+
'fancybox-for-wordpress' => array( 'recommended' => false ),
105104
);
106105

107106
/*
@@ -112,6 +111,14 @@ function shapely_setup() {
112111
* plugin_slug - the plugin's slug (used for installing the plugin)
113112
*
114113
*/
114+
$path = WPMU_PLUGIN_DIR . '/shapely-companion/inc/views/shapely-demo-content.php';
115+
if ( ! file_exists( $path ) ) {
116+
$path = WP_PLUGIN_DIR . '/shapely-companion/inc/views/shapely-demo-content.php';
117+
if ( ! file_exists( $path ) ) {
118+
$path = false;
119+
}
120+
}
121+
115122
$shapely_required_actions = array(
116123
array(
117124
"id" => 'shapely-req-ac-install-companion-plugin',
@@ -128,17 +135,10 @@ function shapely_setup() {
128135
"plugin_slug" => 'jetpack'
129136
),
130137
array(
131-
"id" => 'shapely-req-ac-install-wp-yoast-plugin',
132-
"title" => Shapely_Notify_System::shapely_yoast_title(),
133-
'description' => Shapely_Notify_System::shapely_yoast_description(),
134-
"check" => Shapely_Notify_System::shapely_has_plugin( 'wordpress-seo' ),
135-
"plugin_slug" => 'wordpress-seo'
136-
),
137-
array(
138-
"id" => 'shapely-req-import-content',
139-
"title" => esc_html__( 'Import content', 'shapely' ),
140-
"external" => ABSPATH . 'wp-content/plugins/shapely-companion/inc/views/shapely-demo-content.php',
141-
"check" => Shapely_Notify_System::shapely_check_import_req(),
138+
"id" => 'shapely-req-import-content',
139+
"title" => esc_html__( 'Import content', 'shapely' ),
140+
"external" => $path,
141+
"check" => Shapely_Notify_System::shapely_check_import_req(),
142142
),
143143

144144
);
@@ -202,6 +202,27 @@ function shapely_widgets_init() {
202202

203203
add_action( 'widgets_init', 'shapely_widgets_init' );
204204

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+
205226
/**
206227
* Enqueue scripts and styles.
207228
*/
@@ -241,17 +262,20 @@ function shapely_scripts() {
241262
if ( is_page_template( 'template-home.php' ) ) {
242263
wp_enqueue_script( 'shapely-parallax', get_template_directory_uri() . '/js/parallax.min.js', array( 'jquery' ), '20160115', true );
243264
}
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' );
244271

245272
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' );
246275
}
247276

248277
add_action( 'wp_enqueue_scripts', 'shapely_scripts' );
249278

250-
/**
251-
* Implement the Custom Header feature.
252-
*/
253-
require get_template_directory() . '/inc/custom-header.php';
254-
255279
/**
256280
* Custom template tags for this theme.
257281
*/
@@ -283,19 +307,9 @@ function shapely_scripts() {
283307
require get_template_directory() . '/inc/socialnav.php';
284308

285309
/**
286-
* Load Metboxes
310+
* Load related posts
287311
*/
288-
require get_template_directory() . '/inc/metaboxes.php';
289-
290-
/* Globals */
291-
global $shapely_site_layout;
292-
$shapely_site_layout = array(
293-
'pull-right' => esc_html__( 'Left Sidebar', 'shapely' ),
294-
'side-right' => esc_html__( 'Right Sidebar', 'shapely' ),
295-
'no-sidebar' => esc_html__( 'No Sidebar', 'shapely' ),
296-
'full-width' => esc_html__( 'Full Width', 'shapely' )
297-
);
298-
312+
require get_template_directory() . '/inc/class-shapely-related-posts.php';
299313

300314
/**
301315
* 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: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,17 @@ public static function shapely_check_plugin_is_installed( $slug ) {
6464
if ( $slug === 'wordpress-seo' ) {
6565
$slug2 = 'wp-seo';
6666
}
67-
if ( file_exists( ABSPATH . 'wp-content/plugins/' . $slug . '/' . $slug2 . '.php' ) ) {
67+
68+
$path = WPMU_PLUGIN_DIR . '/' . $slug . '/' . $slug2 . '.php';
69+
if ( ! file_exists( $path ) ) {
70+
$path = WP_PLUGIN_DIR . '/' . $slug . '/' . $slug2 . '.php';
71+
72+
if ( ! file_exists( $path ) ) {
73+
$path = false;
74+
}
75+
}
76+
77+
if ( file_exists( $path ) ) {
6878
return true;
6979
}
7080

@@ -79,7 +89,16 @@ public static function shapely_check_plugin_is_active( $slug ) {
7989
if ( $slug === 'wordpress-seo' ) {
8090
$slug2 = 'wp-seo';
8191
}
82-
if ( file_exists( ABSPATH . 'wp-content/plugins/' . $slug . '/' . $slug2 . '.php' ) ) {
92+
93+
$path = WPMU_PLUGIN_DIR . '/' . $slug . '/' . $slug2 . '.php';
94+
if ( ! file_exists( $path ) ) {
95+
$path = WP_PLUGIN_DIR . '/' . $slug . '/' . $slug2 . '.php';
96+
if ( ! file_exists( $path ) ) {
97+
$path = false;
98+
}
99+
}
100+
101+
if ( file_exists( $path ) ) {
83102
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
84103

85104
return is_plugin_active( $slug . '/' . $slug2 . '.php' );

0 commit comments

Comments
 (0)