Last active
July 31, 2019 07:50
-
-
Save mt8/5fa06848826ac44acfce25cb8418d048 to your computer and use it in GitHub Desktop.
WordPressとBASEを連携させるためのプラグイン「BASE Item List」のテンプレート機能の使い方
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! defined( 'ABSPATH' ) ) exit; | |
global $base_items; | |
/* | |
* item | |
* item_id int | |
* title string | |
* detail string | |
* price int | |
* stock int | |
* **img(n) is 1 to 5** | |
* img(n)_origin string | |
* img(n)_76 string | |
* img(n)_146 string | |
* img(n)_300 string | |
* img(n)_500 string | |
* img(n)_640 string | |
* img(n)_sp_480 string | |
* img(n)_sp_640 string | |
* modified int | |
* shop_id string | |
* shop_name string | |
* shop_url string | |
* categories array (string,string...) | |
*/ | |
?> | |
<?php if ( isset( $base_items ) ) : ?> | |
<div class="base_items"> | |
<ul class="base_items_list"> | |
<?php foreach ( $base_items as $item ) : ?> | |
<li class="base_item"> | |
<dt><span class="base_item_title"><?php echo esc_html( $item->title ); ?></span></dt> | |
<dd> | |
<a href="<?php echo esc_url( $item->shop_url) ?>/items/<?php echo $item->item_id; ?>" target="_blank"> | |
<img src="<?php echo esc_url( $item->img1_300 ); ?>" alt="<?php echo esc_attr( $item->title ); ?>"> | |
</a> | |
<span class="base-item-price"><?php echo esc_html( number_format( $item->price ) );?></span> | |
</dd> | |
</li> | |
<?php endforeach; ?> | |
</ul> | |
</div><!--/.base_items--> | |
<?php endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment