Skip to content

Commit 86f67d6

Browse files
committed
fix itemにshop_urlがなかった
1 parent 467c0e2 commit 86f67d6

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

includes/v2/Admin/Admin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Admin {
1313
'client_id' => '',
1414
'client_secret' => '',
1515
'callback_url' => '',
16+
'shop_url' => '',
1617
);
1718

1819
public function admin_head() {

includes/v2/Admin/View.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ public static function register_setting_fields() {
4444
$section
4545
);
4646

47+
add_settings_field(
48+
'shop_url'
49+
,'ショップURL',
50+
array( View::class, 'field_shop_url' ),
51+
$key,
52+
$section
53+
);
54+
4755
add_settings_field(
4856
'use_default_css'
4957
,'プラグインCSSを使用する',
@@ -270,6 +278,17 @@ function copy_callback_url() {
270278
<?php
271279
}
272280

281+
public static function field_shop_url() { ?>
282+
<input
283+
type="text"
284+
id="shop_url"
285+
name="<?php echo Admin::OPTIONS_KEY ?>[shop_url]"
286+
class="regular-text"
287+
value="<?php echo esc_attr( Admin::option( 'shop_url' ) ) ?>"
288+
/>
289+
<?php
290+
}
291+
273292
public static function field_use_default_css() { ?>
274293
<input
275294
type="checkbox"

includes/v2/Core.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ public function item_list( $items ) {
121121

122122
//set globals
123123
$GLOBALS[ 'base_items' ] = $items;
124+
125+
foreach ( $items as $index => $item ) {
126+
$items[$index]->shop_url = untrailingslashit( Admin::option('shop_url') );
127+
}
124128

125129
ob_start();
126130
if ( is_file( get_stylesheet_directory() . '/base_items.php' ) ) {

0 commit comments

Comments
 (0)