Lightning(無料版)で使用できるアクションフック
1. lightning_header_before
概要: ヘッダー要素の直前にコンテンツを追加するためのフック。
PHP
add_action( 'lightning_header_before', 'my_custom_header_message' );
function my_custom_header_message() {
echo '<div class="custom-header-message">Welcome to my website!</div>';
}2. lightning_header_after
概要: ヘッダー要素の直後にコンテンツを追加するためのフック。
PHP
add_action( 'lightning_header_after', 'my_custom_after_header' );
function my_custom_after_header() {
echo '<div class="after-header">This is after the header.</div>';
}3. lightning_footer_before
概要: フッター要素の直前にコンテンツを追加するためのフック。
PHP
add_action( 'lightning_footer_before', 'my_custom_before_footer' );
function my_custom_before_footer() {
echo '<div class="before-footer">Before Footer Section</div>';
}4. lightning_footer_after
概要: フッター要素の直後にコンテンツを追加するためのフック。
PHP
add_action( 'lightning_footer_after', 'my_custom_footer_message' );
function my_custom_footer_message() {
echo '<p class="custom-footer-message">© 2025 My Website. All rights reserved.</p>';
}5. lightning_page_header
概要: ページタイトルの表示部分にカスタムコンテンツを追加するためのフック。
PHP
add_action( 'lightning_page_header', 'my_custom_page_header' );
function my_custom_page_header() {
echo '<h1 class="custom-page-title">Custom Page Title</h1>';
}6. lightning_before_main_content
概要: メインコンテンツ領域の直前にコンテンツを挿入するためのフック。
PHP
add_action( 'lightning_before_main_content', 'my_custom_content_before' );
function my_custom_content_before() {
echo '<div class="custom-before-content">Important Announcement!</div>';
}7. lightning_after_main_content
概要: メインコンテンツ領域の直後にコンテンツを挿入するためのフック。
PHP
add_action( 'lightning_after_main_content', 'my_custom_content_after' );
function my_custom_content_after() {
echo '<div class="custom-after-content">Thank you for visiting!</div>';
}