The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
PHP code - form report in dashboard - missing CSS
I would like to add a form report in my wordpress dashboard. The form is a list of access requests for the site. So under the "Users" menu item in the dashboard, there will be an "Access Requests" menu item.
In the code to display that page I do:
echo do_shortcode('[formresults id=access_request delete_link="Delete"]');
This displays the report, however, the CSS for the form reports is apparently not included in the dashboard, because the list is not formatted at all. How do I get the formidable CSS to be included for this page?
Thanks
July 7, 2017 at 1:38 pm
In the global settings, I selected the "every page of your site" setting for the "Load form styling" option. Apparently that doesn't include Dashboard pages though, so that menu item isn't totally accurate.
This CSS isn't included in dashboard pages
https://mydomain.com/hr/wp-content/uploads/sites/4/formidable/css/formidablepro.css
I tried the code below, and it is calling FrmStylesController::enqueue_css, but still the css file doesn't get included.
add_action( 'admin_init', 'ga_access_request_list_style' );
function ga_access_request_list_style() {
FrmStylesController::enqueue_css();
}
July 7, 2017 at 2:36 pm
The WordPress hook used for loading scripts into admin is admin_enqueue_scripts. Here are the details: https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts
July 7, 2017 at 3:23 pm
Thanks! This works:
add_action( 'admin_enqueue_scripts', 'access_request_list_style' );
function ga_access_request_list_style($hook) {
if ($hook == 'users_page_access-request-list' && is_callable('FrmStylesController::custom_stylesheet'))
{
$styles = FrmStylesController::custom_stylesheet();
wp_enqueue_style( 'custom_wp_admin_css', $styles['formidable']);
}
}
Discussion closed.