Skip to content

Commit

Permalink
Merge pull request #551 from vektor-inc/develop
Browse files Browse the repository at this point in the history
13.8.9
  • Loading branch information
kurudrive authored Feb 28, 2021
2 parents 7492b94 + 0fb7bc9 commit 57e3d4f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 21 deletions.
41 changes: 32 additions & 9 deletions plugin-support/woocommerce/functions-woo.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,22 @@ function lightning_woo_product_gallery_setup() {
add_theme_support( 'wc-product-gallery-slider' );
}



/**
* ショップトップページに指定している固定ページのデザイン設定を取得
*/
function lightning_woo_get_design_setting(){

// Woo Shop Top Page ( 'shop' is settted for Shop Top that it's not slug. )
$shop_page_id = wc_get_page_id( 'shop' );
$shop_page = get_post( $shop_page_id );

// 固定ページで指定しているレイアウト情報などを取得
$option = get_post_meta( $shop_page_id, '_lightning_design_setting', true );
return $option;
}

/**
* ショップトップのページかどうか?
*/
function lightning_woo_is_shop_page(){
global $post;
if ( 'product' === get_post_type( $post ) && ! is_singular() ) {
Expand All @@ -85,7 +93,7 @@ function lightning_woo_is_shop_page(){
}

/**
* カラム表示制御
* ショップトップページのカラム表示制御
*/
function lightning_woo_is_layout_onecolumn( $return ){
if ( lightning_woo_is_shop_page() ) {
Expand All @@ -107,7 +115,7 @@ function lightning_woo_is_layout_onecolumn( $return ){
add_filter( 'lightning_is_layout_onecolumn', 'lightning_woo_is_layout_onecolumn' );

/**
* サブサクション表示制御
* ショップトップページのサブサクション表示制御
*/
function lightning_woo_is_subsection_display( $return ){
if ( lightning_woo_is_shop_page() ) {
Expand All @@ -132,18 +140,33 @@ function lightning_woo_is_subsection_display( $return ){
add_filter( 'lightning_is_subsection_display', 'lightning_woo_is_subsection_display' );

/**
* ページヘッダーとパンくずの表示制御
* ショップトップページでのページヘッダーの表示制御
*/
function lightning_woo_is_page_header( $return ){
if ( lightning_woo_is_shop_page() ) {
$lightning_design_setting = lightning_woo_get_design_setting();
if ( ! empty( $lightning_design_setting['hidden_page_header'] ) ) {
$return = false;
}
}
return $return;
}
add_filter( 'lightning_is_page_header', 'lightning_woo_is_page_header' );

/**
* ショップトップページでのパンくずの表示制御
*/
function lightning_woo_is_page_header_and_breadcrumb( $return ){
function lightning_woo_is_breadcrumb( $return ){
if ( lightning_woo_is_shop_page() ) {
$lightning_design_setting = lightning_woo_get_design_setting();
if ( ! empty( $lightning_design_setting['hidden_page_header_and_breadcrumb'] ) ) {
if ( ! empty( $lightning_design_setting['hidden_breadcrumb'] ) ) {
$return = false;
}
}
return $return;
}
add_filter( 'lightning_is_page_header_and_breadcrumb', 'lightning_woo_is_page_header_and_breadcrumb' );
add_filter( 'lightning_is_breadcrumb', 'lightning_woo_is_breadcrumb' );


/**
* siteContent の上下余白
Expand Down
9 changes: 6 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
=== Lightning ===
Lightning WordPress theme, Copyright (C) 2015-2020 Vektor,Inc.
Lightning WordPress theme, Copyright (C) 2015-2021 Vektor,Inc.
Lightning WordPress theme is licensed under the GPL.
Tested up to: 5.6.0
Stable tag: 13.8.8
Tested up to: 5.6.2
Stable tag: 13.8.9
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -39,6 +39,9 @@ https://www.vektor-inc.co.jp/inquiry/

== Changelog ==

v13.8.9
[ Bug fix ][ WooCommerce ] Fix Breadcrumb shop top name

v13.8.8
[ Bug fix ] Fix Editor screen width

Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Theme URI: https://lightning.nagoya
Description: Lightning is a very simple & easy to customize theme which is based on the Bootstrap. It is also very friendly with custom post types and custom taxonomies. When you add a new one, the breadcrumbs will be adjusted and posts will look beautifully without editing or adding a template files.
Author: Vektor,Inc.
Author URI: https://www.vektor-inc.co.jp
Version: 13.8.8
Version: 13.8.9
Requires at least: 5.3
Tested up to: 5.6.1
Requires PHP: 5.6.0
Expand Down
15 changes: 7 additions & 8 deletions template-parts/breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ function lightning_bread_crumb() {
// Get Post top page info
/*-------------------------------------------*/
// get_post_type() だとtaxonomyページで該当の投稿がない時に投稿タイプを取得できないため lightning_get_post_type() を使用
$post_type = lightning_get_post_type();
$post_type = $post_type['slug'];
$post_type_object = get_post_type_object( $post_type );
// また、wooCommerceなどはショップトップの名称が投稿タイプ名と異なるので、そのあたりの処理も lightning_get_post_type() で対応済み
$post_type_info = lightning_get_post_type();
$show_on_front = get_option( 'show_on_front' );
$page_for_post = get_option( 'page_for_posts' );
$post_top_name = ! empty( $page_for_post ) ? get_the_title( $page_for_post ) : '';
Expand Down Expand Up @@ -54,20 +53,20 @@ function lightning_bread_crumb() {
/*-------------------------------*/
} elseif ( is_single() || is_page() ||is_category() || is_tag() || is_tax() || is_post_type_archive() || is_date() ) {

if ( 'post' === $post_type && 'page' === $show_on_front && $page_for_post ) { /* including single-post */
if ( 'post' === $post_type_info['slug'] && 'page' === $show_on_front && $page_for_post ) { /* including single-post */
$breadcrumb_html .= '<li' . $microdata_li . '>';
$breadcrumb_html .= '<a' . $microdata_li_a . ' href="' . esc_url( $post_top_url ) . '">';
$breadcrumb_html .= '<span' . $microdata_li_a_span . '>' . $post_top_name . '</span>';
$breadcrumb_html .= '</a>';
$breadcrumb_html .= '</li>';
} elseif ( is_post_type_archive() && ! is_date() ) {
$breadcrumb_html .= '<li>';
$breadcrumb_html .= '<span>' . get_the_archive_title() . '</span>';
$breadcrumb_html .= '<span>' . wp_kses_post( $post_type_info['name'] ) . '</span>';
$breadcrumb_html .= '</li>';
} elseif ( 'post' !== $post_type && 'page' !== $post_type ) {
} elseif ( 'post' !== $post_type_info['slug'] && 'page' !== $post_type_info['slug'] ) {
$breadcrumb_html .= '<li' . $microdata_li . '>';
$breadcrumb_html .= '<a' . $microdata_li_a . ' href="' . get_post_type_archive_link( $post_type ) . '">';
$breadcrumb_html .= '<span' . $microdata_li_a_span . '>' . $post_type_object->label . '</span>';
$breadcrumb_html .= '<a' . $microdata_li_a . ' href="' . get_post_type_archive_link( $post_type_info['slug'] ) . '">';
$breadcrumb_html .= '<span' . $microdata_li_a_span . '>' . wp_kses_post( $post_type_info['name'] ) . '</span>';
$breadcrumb_html .= '</a>';
$breadcrumb_html .= '</li>';
}
Expand Down

0 comments on commit 57e3d4f

Please sign in to comment.