ARCHIVE POST ORDER PLUS:カスタム投稿アーカイブの追加

カスタム投稿アーカイブ対応
全体設定で「全件」指定時に「全体設定に従う」の設定が反映されないバグの修正
This commit is contained in:
2021-07-19 19:47:26 +09:00
parent b8dcf1c44c
commit 4bc96228bd
16 changed files with 848 additions and 338 deletions
+17 -7
View File
@@ -10,6 +10,7 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
<li><?php _e( 'Category', APOP_DOMAIN ); ?></li>
<li><?php _e( 'Tag', APOP_DOMAIN ); ?></li>
<li><?php _e( 'Custom taxonomy', APOP_DOMAIN ); ?></li>
<li><?php _e( 'Custom posts', APOP_DOMAIN ); ?></li>
</ul>
</nav>
<form action="" method="post">
@@ -83,30 +84,39 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
<div class="tax_sort_box">
<?php
$tax_lists = array( 'category' => APOP_UI::get_cat_tag_list( 'cat', 'category' ) );
$tax_title_text = __('Category', APOP_DOMAIN);
$tax_title_text = __( 'Category', APOP_DOMAIN );
include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php';
?>
<?php include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php'; ?>
</div>
</div>
<div class="post-order-box">
<div class="tax_sort_box">
<?php
$tax_lists = array( 'tag_id' => APOP_UI::get_cat_tag_list( 'tag', 'post_tag' ) );
$tax_title_text = __('Tag', APOP_DOMAIN);
$tax_title_text = __( 'Tag', APOP_DOMAIN );
include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php';
?>
<?php include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php'; ?>
</div>
</div>
<div class="post-order-box">
<div class="tax_sort_box">
<?php
$tax_lists = array( 'taxonomy' => APOP_UI::get_cat_tag_list( 'tax', 'taxonomy' ) );
$tax_title_text = __('Custom taxonomy', APOP_DOMAIN);
$tax_title_text = __( 'Custom taxonomy', APOP_DOMAIN );
include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php'; ?>
</div>
</div>
<div class="post-order-box">
<div class="tax_sort_box">
<?php
$custom_posts_lists = APOP_UI::get_enable_custompost_archive();
$custom_posts_title_text = __( 'Custom posts', APOP_DOMAIN );
include APOP_PLUGIN_PATH . 'template/order_parts_custom_posts.php';
?>
<?php include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php'; ?>
</div>
</div>
</div>
<p class="apop-submit"><input type="submit" name="submit" class="button-primary" value="<?php _e( 'Save changes', APOP_DOMAIN ); ?>"/></p>
<p class="apop-submit"><input type="submit" name="submit" class="button-primary"
value="<?php _e( 'Save changes', APOP_DOMAIN ); ?>"/></p>
</form>
</div>
+62
View File
@@ -0,0 +1,62 @@
<?php if ( isset( $custom_posts_lists, $custom_posts_title_text ) ): ?>
<div class="list-orders-outer">
<?php if ( count( $custom_posts_lists ) > 0 ): ?>
<?php foreach ( $custom_posts_lists as $custom_post ) : ?>
<div class="list-orders-inner">
<h3><?php echo esc_html( $custom_post['label'] ); ?></h3>
<?php
$order_target_data = get_option( '_apop_custompost_archive_sort_type' );
if ( isset( $order_target_data[ $custom_post['slug'] ] ) ) {
$order_target = $order_target_data[ $custom_post['slug'] ];
} else {
$order_target = 2;
}
?>
<!-- ソートタイプ -->
<ul class="sort-menu-list"
data-order_target="<?php echo esc_attr( $order_target ); ?>">
<li>
<label>
<input class="sort_menu" type="radio"
name="_apop_custompost_archive_sort_type[<?php echo esc_attr( $custom_post['slug'] ); ?>]"
value="2"<?php checked( $order_target, 2 ); ?>><?php _e( 'Standard + custom field sort', APOP_DOMAIN ); ?>
</label>
</li>
<li>
<label>
<input class="sort_menu" type="radio"
name="_apop_custompost_archive_sort_type[<?php echo esc_attr( $custom_post['slug'] ); ?>]"
value="1"<?php checked( $order_target, 1 ); ?>><?php _e( 'Drag sort', APOP_DOMAIN ); ?>
</label>
</li>
</ul>
<div class="sort_box">
<hr>
<p><?php _e( 'Click "Save Changes" to register the sort.', APOP_DOMAIN ); ?></p>
<ul class="post-order-list drag-sort">
<?php echo APOP_UI::create_custompost_archive_order_list( $custom_post['slug'] ); ?>
</ul>
</div>
<div class="sort_box">
<hr>
<p><?php _e( 'Click "Save Changes" to register the sort.', APOP_DOMAIN ); ?></p>
<div class="enable-box">
<h4><?php _e( 'Enabled', APOP_DOMAIN ); ?></h4>
<ul class="post-order-list search-normal-sort">
<?php APOP_UI::create_custompost_archive_normal_list( $custom_post['slug'] ); ?>
</ul>
</div>
<div class="disable-box">
<h4><?php _e( 'Disabled', APOP_DOMAIN ); ?></h4>
<ul class="disable-normal-list"></ul>
</div>
</div>
</div>
<?php endforeach; ?>
<?php else: ?>
<p class="no-registered-exp"><?php _e( 'No', APOP_DOMAIN ); ?><?php echo esc_html( $custom_posts_title_text . ' ' ); ?><?php _e( 'has been selected.', APOP_DOMAIN ); ?></p>
<?php endif; ?>
</div>
<?php endif;
+1
View File
@@ -40,6 +40,7 @@
<?php APOP_UI::disp_tax_setting( 'category', __( 'Categories setting', APOP_DOMAIN ), '_apop_cat_order' ); ?>
<?php APOP_UI::disp_tax_setting( 'post_tag', __( 'Tags setting', APOP_DOMAIN ), '_apop_tag_order' ); ?>
<?php APOP_UI::disp_tax_setting( 'taxonomy', __( 'Custom Taxonomies setting', APOP_DOMAIN ), '_apop_tax_order' ); ?>
<?php APOP_UI::disp_customposts_setting( 'custompost_archive', __( 'Custom Posts Archive setting', APOP_DOMAIN ), '_apop_custompost_archive_order' ); ?>
</table>
<p class="submit"><input type="submit" name="Submit" class="button-primary"
value="<?php _e( 'Save changes', APOP_DOMAIN ); ?>"/>
+64
View File
@@ -0,0 +1,64 @@
<?php if ( isset( $custom_post_data, $order_name, $order ) ): ?>
<dl class="apop-setting-list">
<dt><?php _e( 'Targets', APOP_DOMAIN ); ?></dt>
<dd>
<ul class="order-setting-list">
<?php foreach ( $custom_post_data as $custom_post_datum => $label ): ?>
<?php
$opt_cat = get_option( $order_name );
$check_slug = $opt_cat['target_post'][ $custom_post_datum ] ?? '';
?>
<li>
<div class="select_cat">
<label>
<input type="hidden"
name="<?php echo esc_attr( $order_name ); ?>[target_post][<?php echo esc_attr( $custom_post_datum ); ?>]"
value="0">
<input class="select_cat_checkbox" type="checkbox"
name="<?php echo esc_attr( $order_name ); ?>[target_post][<?php echo esc_attr( $custom_post_datum ); ?>]"
<?php checked( $check_slug, 1 ); ?>
value="1">
<?php echo esc_html( $label ); ?>
</label>
</div>
<?php $per_page_data = APOP_UI::create_custom_posts_per_page( get_option( '_apop_per_page' ), $order, $custom_post_datum ); ?>
<div class="select-per-page">
<ul>
<li>
<label>
<input class="per_page_cat" type="radio"
name="_apop_per_page[<?php echo esc_attr($order); ?>][<?php echo esc_attr( $custom_post_datum ); ?>]"
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>><?php _e( 'Follow display settings', APOP_DOMAIN ); ?>
<?php echo esc_html( get_option( 'posts_per_page' ) ); ?>
<?php _e( 'Posts', APOP_DOMAIN ); ?></label>
</li>
<li><label>
<input class="per_page_cat" type="radio"
name="_apop_per_page[<?php echo esc_attr( $order ); ?>][<?php echo esc_attr( $custom_post_datum ); ?>]"
value="all"<?php checked( $per_page_data['_per_page'], 'all' ); ?>><?php _e( 'Follow global settings', APOP_DOMAIN ); ?>
</label>
</li>
<li><label>
<input class="per_page_cat" type="radio"
name="_apop_per_page[<?php echo esc_attr( $order ); ?>][<?php echo esc_attr( $custom_post_datum ); ?>]"
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>><?php _e( 'All posts', APOP_DOMAIN ); ?>
</label>
</li>
<li class="set_number_list">
<label><input class="per_page_cat set_number" type="radio"
name="_apop_per_page[<?php echo esc_attr( $order ); ?>][<?php echo esc_attr( $custom_post_datum ); ?>]"
value=""<?php echo esc_attr( $per_page_data['_checked'] ); ?>><?php _e( 'Set the number posts', APOP_DOMAIN ); ?>
<input class="per_page_cat_input" type="text"
name="_apop_per_page[<?php echo esc_attr( $order ); ?>][<?php echo esc_attr( $custom_post_datum ); ?>]"
value="<?php echo esc_attr( $per_page_data['_per_page_num'] ); ?>"
required>
</label>
</li>
</ul>
</div>
</li>
<?php endforeach; ?>
</ul>
</dd>
</dl>
<?php endif;