Created
May 1, 2023 07:42
-
-
Save takunagai/f8b5ac8707b55db5ddf3bc20261d8200 to your computer and use it in GitHub Desktop.
[Short Code Output] #WordPress
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(); | |
dynamic_sidebar( 'isp_businesscalendar-4' ); | |
return ob_get_clean(); | |
} | |
/*------------------------------------------- | |
* テンプレートに配されているウィジェット(ID付き)の一覧を出力 | |
* 表示させたい箇所に `[show_all_widgets_shortcode]` | |
* http://www.is-p.cc/wordpress/plug-in/business-calendar/700 | |
* ----------------------------------------- */ | |
add_shortcode( 'show_all_widgets_shortcode', 'show_all_widgets' ); | |
function show_all_widgets() { | |
global $wp_registered_widgets; | |
foreach($wp_registered_widgets as $val){ | |
$widgets .= $val['name'] . ':' . $val['id'] . '<br />'; | |
} | |
return $widgets; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment