- https://
- @nagai_shouten
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
/** | |
* ランダムな整数を返す | |
* @param min 最小値 | |
* @param max 最大値 | |
* @returns min 以上 max 以下のランダムな整数 | |
*/ | |
export function getRandomInt(min: number, max: number): number { | |
return Math.floor(Math.random() * (max - min + 1)) + min | |
} |
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
async function copyUrlToClipboard(text) { | |
try { | |
await navigator.clipboard.writeText(text); | |
console.info('Successfully copied URL'); | |
} catch (err) { | |
console.log(err) | |
return { error: err } | |
} | |
return { success: true } |
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 | |
/** | |
* WordPress データのシリアル化とデータベースへの入出力 | |
* @ref: https://wporz.com/wordpress-serialize/ | |
*/ | |
/** | |
* 複数のデータを配列にセットしシリアル化、wp_options テーブルに保存 | |
*/ | |
$update[] = $data1; |
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
<{* IE11 対応 for Bootstrap 5 (polyfill.io を使用) | |
* Fix preventDefault for IE | |
* @ref { @link https://polyfill.io/v3/ } | |
* リクエストの User-Agent ヘッダーを読み、要求元のブラウザに適した polyfills を返す | |
* このため、モダンブラウザでアクセスしてもコードは表示されない | |
* https://polyfill.io/v3/polyfill.min.js?features=es5 でもいける? *}> | |
<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js"></script> | |
<script> | |
(function() { | |
const workingDefaultPrevented = (function() { |
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
/* | |
Creating a shine effect on a card with Tailwind CSS | |
https://www.julienthibeaut.xyz/blog/create-shine-effect-on-card-with-tailwind-css?utm_campaign=tailwind-weekly-121&utm_source=Tailwind+Weekly | |
*/ | |
export const CardShineEffect = () => { | |
return ( | |
<div className="bg-[linear-gradient(45deg,transparent_25%,rgba(68,68,68,.2)_50%,transparent_75%,transparent_100%)] bg-zinc-950 relative max-w-md overflow-hidden rounded-xl border border-slate-900 bg-[length:250%_250%,100%_100%] bg-[position:-100%_0,0_0] bg-no-repeat px-8 py-16 shadow-2xl transition-[background-position_0s_ease] hover:bg-[position:200%_0,0_0] hover:duration-[1500ms]"> | |
<span className="mb-4 inline-flex items-center justify-center rounded-md bg-blue-600 p-2 shadow-lg"> | |
<svg | |
className="h-6 w-6 text-white" |
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 | |
/*------------------------------------------- | |
* Businesscalendar Plugin のウィジェットを | |
* ショートコードで使えるように | |
* 表示させたい箇所に `[widget_shortcode]` | |
* http://www.is-p.cc/wordpress/plug-in/business-calendar/700 | |
* ----------------------------------------- */ | |
add_shortcode( 'businesscalendar_shortcode', 'add_businesscalendar_shortcode' ); | |
function add_businesscalendar_shortcode() { | |
ob_start(); |
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
# WordPress 記事タイトル/アイキャッチ画像のID を表示 | |
select | |
a.id 'ID', | |
a.post_title 'タイトル', | |
c.guid 'アイキャッチ URL' | |
from | |
(select * from wpgh_posts | |
where post_type in ('post','page','lesson') | |
and post_status='publish') a | |
left outer join wpgh_postmeta b |
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 | |
/** | |
* Support menu-4, menu-5 on MegaMenu. | |
* Default: Only Support primary, secondary, menu-3 menus | |
*/ | |
add_filter( 'astra_nav_mega_menu_support', 'custom_megamenu_support', 10, 1 ); | |
function custom_megamenu_support( $nav_menus ) { | |
$nav_menus[] = 'menu_3'; | |
$nav_menus[] = 'menu_4'; | |
return $nav_menus; |
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 | |
/** | |
* Spectra - Disable the Block display conditions for Page post type. | |
* @ref https://wpspectra.com/docs/display-conditions-blocks/ | |
*/ | |
add_filter( 'enable_block_condition', function( $default = true) { | |
if (isset($_REQUEST['post_type']) && 'page' === $_REQUEST['post_type']) { | |
return false; | |
} elseif (isset($_GET['post']) && 'page' === get_post_type($_GET['post'])) { | |
return false; |
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 | |
/** | |
* サポートウィジェット | |
* サポート用外部サイトのRSSを取得し表示 | |
*/ | |
function astra_child_custom_dashboard_support() { | |
?> | |
<p> | |
<a href="#">» Webページで見る</a> | |
<a href="https://sitename.com/form-support" target="_blank">» お問合せ</a> |
NewerOlder