HEX
Server: Apache
System: Linux 4485441ca2e2 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 11:03:07 UTC 2025 aarch64
User: (1000)
PHP: 8.2.24
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/themes/ganryujima_new_1606 backup/lib/init.php
<?php

/* サムネイルのサイズ設定 */
add_image_size( '4-3', 480, 360, true );
add_image_size( '3-2', 480, 320, true );
add_image_size( '16-9', 480, 270, true );
add_image_size( 'icon', 230, 230, true );

//ページネーション
function wp_pagination() {
	global $wp_query;
	$big = 99999999;
	$page_format = paginate_links( array(
		'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
		'format' => '?paged=%#%',
		'current' => max( 1, get_query_var('paged') ),
		'total' => $wp_query->max_num_pages,
		'type'  => 'array'
	) );
	if( is_array($page_format) ) {
		echo '<div class="m_pagination"><ul>';
		foreach ( $page_format as $page ) {
      echo "<li>$page</li>";
		}
    echo '</ul></div>';
	}
	wp_reset_query();
}

//検索フォーム組み立て
function my_search_form( $form ) {
    $form = '<form class="search" role="search" method="get" id="searchform" action="'.home_url( '/' ).'" >
    <div>
      <input type="text" value="' . get_search_query() . '" name="s" id="s" />
      <button type="submit" id="searchsubmit" >
        <i class="fa fa-search"></i>
      </button>
    </div>
    </form>';
    return $form;
}
add_filter( 'get_search_form', 'my_search_form' );

/**
 * 武道とはのカスタム投稿タイプを作成
 */
add_action('init', 'define_budo');
function define_budo() {
	register_post_type('grjm_budo', array(
		'label' => '巌流島ブロマガ',
		'public' => true,
    'has_archive' => true,
		'menu_icon' => 'dashicons-megaphone',
		'supports'=> array('title', 'editor', 'thumbnail'),
		'rewrite' => false
	));
}

/**
 * 大会のカスタム投稿タイプを作成
 */
add_action('init', 'define_events');
function define_events() {
	register_post_type('grjm_events', array(
		'label' => 'イベント情報',
		'public' => true,
    'has_archive' => true,
		'menu_icon' => 'dashicons-tickets-alt',
		'supports'=> array('title', 'editor', 'thumbnail'),
		'rewrite' => false
	));
}

/**
 * 大会結果のカスタム投稿タイプを作成
 */
add_action('init', 'define_event_results');
function define_event_results() {
	register_post_type('grjm_event_results', array(
		'label' => '試合結果',
		'public' => true,
    'has_archive' => true,
		'menu_icon' => 'dashicons-calendar-alt',
		'supports'=> array('title', 'editor', 'thumbnail'),
		'rewrite' => false
	));
}

/**
 * 議論のカスタム投稿タイプを作成
 */
add_action('init', 'define_discussion');
function define_discussion() {
	register_post_type('grjm_discussion', array(
		'label' => '議論',
		'public' => true,
    'has_archive' => true,
		'menu_icon' => 'dashicons-format-chat',
		'supports'=> array('title', 'editor', 'thumbnail', 'comments'),
	));
}

/**
 * テレビのカスタム投稿タイプを作成
 */
add_action('init', 'define_tv');
function define_tv() {
	register_post_type('grjm_tv', array(
		'label' => 'テレビ情報',
		'public' => true,
    'has_archive' => true,
		'menu_icon' => 'dashicons-desktop',
		'supports'=> array('title', 'editor', 'thumbnail', 'comments'),
	));
}

/**
 * ファイターのカスタム投稿タイプを作成
 */
add_action('init', 'define_fighter');
function define_fighter() {
	register_post_type('grjm_fighter', array(
		'label' => 'ファイター',
		'public' => true,
    'has_archive' => true,
		'menu_icon' => 'dashicons-groups',
		'supports' => array('title', 'editor', 'thumbnail'),
		'rewrite' => false
	));
  /**
   * ファイターの階級タグを作成
   */
  register_taxonomy(
    'fighter-weight',
    'grjm_fighter',
    array(
      'hierarchical' => false,
      'update_count_callback' => '_update_post_term_count',
      'label' => '階級',
      'singular_label' => '階級',
      'public' => true,
      'show_ui' => true
    )
  );
  /**
   * ファイターの出身格闘技タグを作成
   */
  register_taxonomy(
    'fighter-base',
    'grjm_fighter',
    array(
      'hierarchical' => false,
      'update_count_callback' => '_update_post_term_count',
      'label' => '出身格闘技',
      'singular_label' => '出身格闘技',
      'public' => true,
      'show_ui' => true
    )
  );
}

// 画像にカテゴリーを付ける
add_action('init', 'add_category_to_attachment');
function add_category_to_attachment() {
  register_taxonomy_for_object_type('category','attachment');
}

/**
 * 抜粋の文字数制限
 */
function custom_excerpt_length( $length ) {
  return 70;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

/**
 * 抜粋の末尾変更
 */
function new_excerpt_more($more) {
	return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');

?>