使用プラグインはAll-in-One Video Galleryで、プラグインからショートコードを作成できるのですが現在の並び順がorder=ascになっております。
そのためorder=descを該当するphpファイルに追加しました。
反映はされたのですが、プラグインをアップデートをしたら消えてしまうので消えないようにするために色々と調べたら以下のURLから独自のテンプレートを作成できることを知り、フォルダやファイルを作成したものの反映されなく困っております。
https://plugins360.com/all-in-one-video-gallery/child-themes-and-templates/
独自テンプレート
PHP
1<?php 2/* 3 * Plugin Name: AIOVG – Custom Templates 4 * Plugin URI: https://plugins360.com 5 * Description: This plugin replaces default All-in-One Video Gallery plugin public/templates/search-form-template-horizontal.php file with search-form-template-horizontal.php file inside this plugin directory. 6 * Author: Team Plugins360 7 */ 8 9// Exit if accessed directly 10if ( ! defined( 'WPINC' ) ) { 11 die; 12} 13 14function aiovg_custom_videos_template( $tpl ) { 15 // $tpl is an absolute path to a file, for example 16 // ../public_html/wp/wp-content/plugins/all-in-one-video-gallery/public/templates/search-form-template-horizontal.php 17 18 $basename = basename( $tpl ); 19 // search-form-template-horizontal.php 20 21 if ( 'search-form-template-horizontal' == $basename ) { 22 // return path to search-form-template-horizontal.php file in aiovg-custom-templates directory 23 return dirname( __FILE__ ) . '/search-form-template-horizontal.php'; 24 } else { 25 return $tpl; 26 } 27} 28 29add_filter( 'aiovg_load_template', 'aiovg_custom_videos_template' );
該当するPHP
PHP
1<?php 2 3/** 4 * Search Form: Horizontal Layout. 5 * 6 * @link https://plugins360.com 7 * @since 1.0.0 8 * 9 * @package All_In_One_Video_Gallery 10 */ 11?> 12 13<div class="aiovg aiovg-search-form aiovg-search-form-template-horizontal"> 14 <form method="get" action="<?php echo esc_url( aiovg_get_search_page_url() ); ?>"> 15 <?php if ( ! get_option('permalink_structure') ) : ?> 16 <input type="hidden" name="page_id" value="<?php echo esc_attr( $attributes['search_page_id'] ); ?>" /> 17 <?php endif; ?> 18 19 <?php if ( $attributes['has_keyword'] ) : ?> 20 <div class="aiovg-form-group aiovg-field-keyword"> 21 <input type="text" name="vi" class="aiovg-form-control" placeholder="<?php esc_attr_e( 'Enter your Keyword', 'all-in-one-video-gallery' ); ?>" value="<?php echo isset( $_GET['vi'] ) ? esc_attr( $_GET['vi'] ) : ''; ?>" /> 22 </div> 23 <?php endif; ?> 24 25 <?php if ( $attributes['has_category'] ) : ?> 26 <div class="aiovg-form-group aiovg-field-category"> 27 <?php 28 $categories_args = array( 29 'show_option_none' => '-- ' . esc_html__( 'Select a Category', 'all-in-one-video-gallery' ) . ' --', 30 'option_none_value' => '', 31 'taxonomy' => 'aiovg_categories', 32 'name' => 'ca', 33 'class' => 'aiovg-form-control', 34 'orderby' => 'name', 35 'order' => 'desc',//こちらを追加 36 'selected' => isset( $_GET['ca'] ) ? (int) $_GET['ca'] : '', 37 'hierarchical' => true, 38 'depth' => 10, 39 'show_count' => false, 40 'hide_empty' => false, 41 ); 42 43 $categories_args = apply_filters( 'aiovg_search_form_categories_args', $categories_args ); 44 wp_dropdown_categories( $categories_args ); 45 ?> 46 </div> 47 <?php endif; ?> 48 49 <?php if ( $attributes['has_tag'] ) : ?> 50 <div class="aiovg-form-group aiovg-field-tag"> 51 <?php 52 $tags_args = array( 53 'taxonomy' => 'aiovg_tags', 54 'orderby' => 'name', 55 'order' => 'asc', 56 'hide_empty' => false 57 ); 58 $terms = get_terms( $tags_args ); 59 60 $selected_tags = array(); 61 if ( isset( $_GET['ta'] ) ) { 62 $selected_tags = array_map( 'intval', $_GET['ta'] ); 63 $selected_tags = array_filter( $selected_tags ); 64 } 65 66 // Dropdown 67 echo '<select class="aiovg-form-control">'; 68 echo '<option value="">-- ' . esc_html__( 'Select Tags', 'all-in-one-video-gallery' ) . ' --</option>'; 69 70 if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { 71 foreach ( $terms as $term ) { 72 printf( 73 '<option value="%d"%s>%s</option>', 74 $term->term_id, 75 ( in_array( $term->term_id, $selected_tags ) ? ' disabled' : '' ), 76 esc_html( $term->name ) 77 ); 78 } 79 } 80 81 echo '</select>'; 82 ?> 83 </div> 84 <?php endif; ?> 85 86 <div class="aiovg-form-group aiovg-field-submit aiovg-hidden-mobile"> 87 <input type="submit" class="aiovg-button" value="<?php esc_attr_e( 'Search', 'all-in-one-video-gallery' ); ?>" /> 88 </div> 89 90 <?php 91 if ( $attributes['has_tag'] ) { 92 // Tags List 93 echo '<div class="aiovg-tags-list">'; 94 95 if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { 96 foreach ( $terms as $term ) { 97 if ( in_array( $term->term_id, $selected_tags ) ) { 98 $html = '<span class="aiovg-tag-item" data-id="' . (int) $term->term_id . '">'; 99 $html .= '<span class="aiovg-tag-item-name">' . esc_html( $term->name ) . '</span>'; 100 $html .= '<span class="aiovg-tag-item-close">×</span>'; 101 $html .= '<input type="hidden" name="ta[]" value="' . (int) $term->term_id . '" />'; 102 $html .= '</span>'; 103 104 echo $html; 105 } 106 } 107 } 108 109 echo '</div>'; 110 } 111 ?> 112 113 <div class="aiovg-form-group aiovg-field-submit aiovg-hidden-desktop"> 114 <input type="submit" class="aiovg-button" value="<?php esc_attr_e( 'Search', 'all-in-one-video-gallery' ); ?>" /> 115 </div> 116 </form> 117</div> 118
色々と調べたのですが解決策が見つからなく、お手数ですがご教授の方宜しくお願い致します。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。