Skip to content

Instantly share code, notes, and snippets.

View ixkaito's full-sized avatar

Kite ixkaito

View GitHub Profile
<?php
function my_must_login_pages() {
if ( is_feed() ) // フィードの時は除外
return;
$loginflg = false; // 条件が増えてもいいようにフラグを作っておく。 デフォルトはfalse
if ( is_singular( 'works' ) && has_term( 'private', 'category' ) ) { // カスタム投稿タイプ works の個別記事でかつカスタムタクソノミー works_cat で タームが private
$loginflg = true;
@ixkaito
ixkaito / functions.php
Created February 3, 2016 21:13
WordPress Custom Menu Order
<?php
function custom_menu_order( $menu_order ) {
return array(
'index.php', // Dashboard
'separator1', // Separator 1
'edit.php', // Posts
'upload.php', // Media
'edit.php?post_type=page', // Pages
'edit-comments.php', // Comments
'separator2', // Separator 2
@ixkaito
ixkaito / functions.php
Created February 3, 2016 21:17
WordPress Remove Admin Menus
<?php
function remove_admin_menus() {
remove_menu_page( 'index.php' ); // Dashboard
remove_menu_page( 'edit.php' ); // Posts
remove_menu_page( 'upload.php' ); // Media
remove_menu_page( 'edit.php?post_type=page' ); // Pages
remove_menu_page( 'edit-comments.php' ); // Comments
remove_menu_page( 'themes.php' ); // Appearance
remove_menu_page( 'plugins.php' ); // Plugins
remove_menu_page( 'users.php' ); // Users
#!/bin/bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#
@ixkaito
ixkaito / .htaccess
Created April 27, 2019 10:26
Redirect www to non-www and HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
@ixkaito
ixkaito / .htaccess
Last active April 8, 2020 05:59
Redirect non-www to www and HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^(.*)$ https://www.%1/$1 [R=301,L]
@ixkaito
ixkaito / .htaccess
Created April 27, 2019 10:41
Redirect HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
<?php
/**
* Takes any number of class names or arrays of class names and returns a string of unique class names.
*
* @param mixed ...$classnames Any number of class names or arrays of class names.
*
* @return string A string of unique class names.
*/
function clsx( ...$classnames ) {
$classnames = array_filter(