Forums › Forums › Search & Filter Pro › Add shortcodes into admin dashboard widgets
Tagged: shortcode admin dashboard
- This topic has 5 replies, 2 voices, and was last updated 8 years, 1 month ago by
Trevor.
Viewing 6 posts - 1 through 6 (of 6 total)
-
Anonymous(Private) March 9, 2017 at 3:06 pm #95763
Dear Trevor,
the widget is part of a plugin that I wrote.
Here is the code.Shortcode definition:
function search_func( ) { echo do_shortcode('[searchandfilter id=1067]' ); } add_shortcode( 'test_search', 'search_func' );
Admin dashboard widget definition:
add_action( 'wp_dashboard_setup', 'register_my_dashboard_widget' ); function register_my_dashboard_widget() { wp_add_dashboard_widget( 'my_dashboard_widget', 'My Dashboard Widget', 'my_dashboard_widget_display' ); } function my_dashboard_widget_display() { echo do_shortcode('[test_search]'); }
This code just prints “[searchandfilter id=1067]” string into “My Dashboard Widget” widget.
It doesn’t show the content of search filter. Why?
Is it possible to do so?
—
Hope this helps.
Andrea -
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)