Version Description
[ bug fix ][ share button ] cope with loop display
Download this release
Release Info
Developer | kurudrive |
Plugin | VK All in One Expansion Unit |
Version | 9.49.4.0 |
Comparing to | |
See all releases |
Code changes from version 9.49.3.0 to 9.49.4.0
- inc/sns/function_snsBtns.php +1 -1
- inc/sns/sns.php +71 -16
- package-lock.json +3 -3
- readme.txt +4 -1
- tests/test-sns-title.php +34 -33
- vkExUnit.php +1 -1
inc/sns/function_snsBtns.php
CHANGED
@@ -129,7 +129,7 @@ function veu_sns_icon_css( $options ) {
|
|
129 |
return $snsBtn_color;
|
130 |
}
|
131 |
|
132 |
-
function
|
133 |
return veu_get_sns_btns( $attr );
|
134 |
}
|
135 |
|
129 |
return $snsBtn_color;
|
130 |
}
|
131 |
|
132 |
+
function veu_sns_block_callback( $attr ) {
|
133 |
return veu_get_sns_btns( $attr );
|
134 |
}
|
135 |
|
inc/sns/sns.php
CHANGED
@@ -34,7 +34,7 @@ function vew_sns_block_setup() {
|
|
34 |
),
|
35 |
'editor_style' => 'vkExUnit_sns_editor_style',
|
36 |
'editor_script' => 'veu-block',
|
37 |
-
'render_callback' => '
|
38 |
'supports' => array(),
|
39 |
)
|
40 |
);
|
@@ -101,32 +101,87 @@ function veu_get_sns_options_default() {
|
|
101 |
*/
|
102 |
function veu_get_the_sns_title( $post_id = '' ) {
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
if ( ! $post_id ) {
|
105 |
$post_id = get_the_id();
|
106 |
}
|
107 |
-
$options = veu_get_sns_options();
|
108 |
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
$title = get_post_meta( $post_id, 'vkExUnit_sns_title', true );
|
120 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
-
if (
|
123 |
-
if (
|
124 |
-
$
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
}
|
128 |
}
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
return strip_tags( $title );
|
131 |
}
|
132 |
|
34 |
),
|
35 |
'editor_style' => 'vkExUnit_sns_editor_style',
|
36 |
'editor_script' => 'veu-block',
|
37 |
+
'render_callback' => 'veu_sns_block_callback',
|
38 |
'supports' => array(),
|
39 |
)
|
40 |
);
|
101 |
*/
|
102 |
function veu_get_the_sns_title( $post_id = '' ) {
|
103 |
|
104 |
+
|
105 |
+
/*
|
106 |
+
注意 :
|
107 |
+
アーカイブなどのループで使われる場合を想定すると、
|
108 |
+
is_singular() / is_single() / is_page() / is_archive() / is_front_page()
|
109 |
+
などの条件分岐は単体では正常に動作させられない
|
110 |
+
例) ループの中の投稿の場合、そのページ自体がsingularページであるとは限らないため is_singular() で条件分岐すると誤動作してしまう
|
111 |
+
*/
|
112 |
+
|
113 |
+
$title = '';
|
114 |
+
$site_title = get_bloginfo( 'name' );
|
115 |
+
$options_sns = veu_get_sns_options();
|
116 |
if ( ! $post_id ) {
|
117 |
$post_id = get_the_id();
|
118 |
}
|
|
|
119 |
|
120 |
+
/**
|
121 |
+
*
|
122 |
+
* [ 通常 ]
|
123 |
+
*
|
124 |
+
* → 投稿タイトル + サイト名
|
125 |
+
*
|
126 |
+
*/
|
127 |
|
128 |
+
$title = get_the_title( $post_id ) . ' | ' . $site_title;
|
129 |
+
|
130 |
+
/**
|
131 |
+
*
|
132 |
+
* [ OGのタイトルを投稿タイトルだけにするチェックが入っている場合 ]
|
133 |
+
*
|
134 |
+
* → 投稿タイトル
|
135 |
+
*
|
136 |
+
*/
|
137 |
+
if ( ! empty( $options_sns['snsTitle_use_only_postTitle'] ) ) {
|
138 |
+
$title = get_the_title( $post_id );
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* [ metaboxでOG用のタイトルが別途登録されている場合 ]
|
143 |
+
*
|
144 |
+
* → OG用のタイトルを返す
|
145 |
+
*
|
146 |
+
*/
|
147 |
+
if ( ! empty( get_post_meta( $post_id, 'vkExUnit_sns_title', true ) ) ) {
|
148 |
$title = get_post_meta( $post_id, 'vkExUnit_sns_title', true );
|
149 |
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* [ 投稿タイトルと異なるケース1]
|
153 |
+
*
|
154 |
+
* サイトのトップが固定ページに指定されている &&
|
155 |
+
* この関すが呼び出された投稿がサイトトップに指定された固定ページ &&
|
156 |
+
* サイトタイトルの書き換えに入力がある
|
157 |
+
*
|
158 |
+
* → 特別に入力されたサイトタイトルを返す
|
159 |
+
*/
|
160 |
|
161 |
+
if ( is_front_page() || is_home() ){
|
162 |
+
if ( get_option( 'show_on_front' ) === 'page' ){
|
163 |
+
$page_on_front = get_option( 'page_on_front' );
|
164 |
+
if ( $page_on_front == $page_id ){
|
165 |
+
$options_veu_wp_title = get_option( 'vkExUnit_wp_title' );
|
166 |
+
if ( ! empty( $options_veu_wp_title['extend_frontTitle'] ) && veu_package_is_enable( 'wpTitle' ) ) {
|
167 |
+
$title = $options_veu_wp_title['extend_frontTitle'];
|
168 |
+
} else {
|
169 |
+
$title = get_bloginfo( 'name' );
|
170 |
+
}
|
171 |
+
}
|
172 |
}
|
173 |
}
|
174 |
|
175 |
+
/**
|
176 |
+
* [ どれにも当てはまらなかった場合(基本ないはず) ]
|
177 |
+
*
|
178 |
+
* → wp_title()を返す
|
179 |
+
*/
|
180 |
+
|
181 |
+
if ( ! $title ) {
|
182 |
+
$title = wp_title( '', false );;
|
183 |
+
}
|
184 |
+
|
185 |
return strip_tags( $title );
|
186 |
}
|
187 |
|
package-lock.json
CHANGED
@@ -4324,9 +4324,9 @@
|
|
4324 |
"dev": true
|
4325 |
},
|
4326 |
"ini": {
|
4327 |
-
"version": "1.3.
|
4328 |
-
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.
|
4329 |
-
"integrity": "sha512-
|
4330 |
"dev": true
|
4331 |
},
|
4332 |
"inquirer": {
|
4324 |
"dev": true
|
4325 |
},
|
4326 |
"ini": {
|
4327 |
+
"version": "1.3.8",
|
4328 |
+
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
4329 |
+
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
|
4330 |
"dev": true
|
4331 |
},
|
4332 |
"inquirer": {
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
4 |
Tags: Google Analytics, New posts, Related Posts, sitemap, sns, twitter card, Facebook Page Plugin, OG tags,
|
5 |
Requires at least: 5.3.0
|
6 |
Tested up to: 5.6.0
|
7 |
-
Stable tag: 9.49.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -81,6 +81,9 @@ e.g.
|
|
81 |
|
82 |
== Changelog ==
|
83 |
|
|
|
|
|
|
|
84 |
= 9.49.3.0 =
|
85 |
[ bug fix ][ Before loop widget area ] fix translate
|
86 |
|
4 |
Tags: Google Analytics, New posts, Related Posts, sitemap, sns, twitter card, Facebook Page Plugin, OG tags,
|
5 |
Requires at least: 5.3.0
|
6 |
Tested up to: 5.6.0
|
7 |
+
Stable tag: 9.49.4.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
81 |
|
82 |
== Changelog ==
|
83 |
|
84 |
+
= 9.49.4.0 =
|
85 |
+
[ bug fix ][ share button ] cope with loop display
|
86 |
+
|
87 |
= 9.49.3.0 =
|
88 |
[ bug fix ][ Before loop widget area ] fix translate
|
89 |
|
tests/test-sns-title.php
CHANGED
@@ -56,27 +56,28 @@ class SnsTitleTest extends WP_UnitTestCase {
|
|
56 |
'site_name' => 'Site name',
|
57 |
'correct' => 'Post Title | Site name',
|
58 |
),
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
//
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
80 |
);
|
81 |
|
82 |
$before_blogname = get_option( 'blogname' );
|
@@ -117,18 +118,18 @@ class SnsTitleTest extends WP_UnitTestCase {
|
|
117 |
// setup_postdata() しないと wp_title() の書き換えの所で get_the_id() が拾えないため
|
118 |
setup_postdata( $post );
|
119 |
|
120 |
-
} elseif ( $test_value['page_type'] == 'is_front_page' ) {
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
}
|
133 |
|
134 |
$return = veu_get_the_sns_title( $post_id );
|
56 |
'site_name' => 'Site name',
|
57 |
'correct' => 'Post Title | Site name',
|
58 |
),
|
59 |
+
// トップページはループ配置された時に対応するためにロジック変更
|
60 |
+
// array(
|
61 |
+
// 'page_type' => 'is_front_page',
|
62 |
+
// 'sns_options__snsTitle_use_only_postTitle' => false,
|
63 |
+
// 'vkExUnit_sns_title' => null,
|
64 |
+
// 'vkExUnit_wp_title' => array( 'extend_frontTitle' => 'ExUnitCustomFrontTitle' ),
|
65 |
+
// 'package_wp_title' => true,
|
66 |
+
// 'post_title' => 'Post Title',
|
67 |
+
// 'site_name' => 'Site name',
|
68 |
+
// 'correct' => 'ExUnitCustomFrontTitle',
|
69 |
+
// ),
|
70 |
+
// // タイトル書き換え機能が停止されている時はトップのタイトル名が保存されていてもWordPressのタイトル名をそのまま返す
|
71 |
+
// array(
|
72 |
+
// 'page_type' => 'is_front_page',
|
73 |
+
// 'sns_options__snsTitle_use_only_postTitle' => false,
|
74 |
+
// 'vkExUnit_sns_title' => null,
|
75 |
+
// 'vkExUnit_wp_title' => array( 'extend_frontTitle' => 'ExUnitCustomFrontTitle' ),
|
76 |
+
// 'package_wp_title' => false,
|
77 |
+
// 'post_title' => 'Post Title',
|
78 |
+
// 'site_name' => 'Site name',
|
79 |
+
// 'correct' => 'Site name',
|
80 |
+
// ),
|
81 |
);
|
82 |
|
83 |
$before_blogname = get_option( 'blogname' );
|
118 |
// setup_postdata() しないと wp_title() の書き換えの所で get_the_id() が拾えないため
|
119 |
setup_postdata( $post );
|
120 |
|
121 |
+
// } elseif ( $test_value['page_type'] == 'is_front_page' ) {
|
122 |
+
// // Set Custom front title
|
123 |
+
// update_option( 'vkExUnit_wp_title', $test_value['vkExUnit_wp_title'] );
|
124 |
+
// // タイトルの書き換え機能がオフの場合の確認
|
125 |
+
// if ( $test_value['package_wp_title'] === false ) {
|
126 |
+
// $options = get_option( 'vkExUnit_common_options' );
|
127 |
+
// // 有効化設定の値をタイトル書き換え無効化に設定
|
128 |
+
// $options['active_wpTitle'] = false;
|
129 |
+
// update_option( 'vkExUnit_common_options', $options );
|
130 |
+
// }
|
131 |
+
// // トップページの時の値を確認するためにトップに移動
|
132 |
+
// $this->go_to( home_url( '/' ) );
|
133 |
}
|
134 |
|
135 |
$return = veu_get_the_sns_title( $post_id );
|
vkExUnit.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: VK All in One Expansion Unit
|
4 |
* Plugin URI: https://ex-unit.nagoya
|
5 |
* Description: This plug-in is an integrated plug-in with a variety of features that make it powerful your web site. Many features can be stopped individually. Example Facebook Page Plugin,Social Bookmarks,Print OG Tags,Print Twitter Card Tags,Print Google Analytics tag,New post widget,Insert Related Posts and more!
|
6 |
-
* Version: 9.49.
|
7 |
* Author: Vektor,Inc.
|
8 |
* Text Domain: vk-all-in-one-expansion-unit
|
9 |
* Domain Path: /languages
|
3 |
* Plugin Name: VK All in One Expansion Unit
|
4 |
* Plugin URI: https://ex-unit.nagoya
|
5 |
* Description: This plug-in is an integrated plug-in with a variety of features that make it powerful your web site. Many features can be stopped individually. Example Facebook Page Plugin,Social Bookmarks,Print OG Tags,Print Twitter Card Tags,Print Google Analytics tag,New post widget,Insert Related Posts and more!
|
6 |
+
* Version: 9.49.4.0
|
7 |
* Author: Vektor,Inc.
|
8 |
* Text Domain: vk-all-in-one-expansion-unit
|
9 |
* Domain Path: /languages
|