You can turn on output buffering, include
(and evaluate) the PHP file, and save the output (of the evaluated code) in a variable, like so:
ob_start();
include 'docs/row_layouts.php';
$html = ob_get_clean();
Then just use 'html' => $html
in the meta
array when you call the $admin_bar->add_menu()
.
Or if you don’t need to evaluate any PHP code in the file, you could use file_get_contents()
:
'html' => file_get_contents( 'docs/row_layouts.php' )
And you may need to or better use a full absolute path.
Related Posts:
- Admin pages have no content
- Add a Separator to the Admin Menu?
- Adding a custom admin page
- How to remove entire admin menu?
- Plugin to remove Admin menu items based on user role?
- Add my own button next to “Screen options” and “Help” in the admin
- Modify Admin Bar Link
- How to show custom menu items in the WordPress android app?
- A similar hook as wp_head for the admin area
- Remove ability to access certain admin menus
- Appearance->Editor not visible
- Custom WP_List_Table displays blank rows
- How do I set up a webhook?
- How to Add Admin Bar and Admin Menu or Submenu Notification Bubbles?
- WordPress Left Hand Side Admin Menu Always Collapsed
- Reorder plugin items in the admin menu
- Re-ordering Admin Submenu Sections
- Reference external file as a function
- Add number new posts (post_status = pending) to administration menu [duplicate]
- add_submenu_page set for multiple roles [duplicate]
- How To Create User Specific Admin User Pages?
- Change the Default Pages Menu View in wp-admin
- How to change admin menu position of “Media”?
- disable admin-bar search field for specific roles
- Change top level menu item to point to custom submenu item
- Change home-url in dashboard
- Associating custom submenu item with post type of top level menu item
- What determines whether admin toolbar is shown to a logged-in user?
- Admin doesn’t have sufficient permissions to plugin’s page
- Restore original WP admin bar after BuddyPress install [closed]
- Remove Admin sidebar link
- Disable the “Skip to Toolbar” tabbing accessibility feature
- Single category’s posts list in admin menu
- Dashboard menu missing
- WordPress Remove Submenus
- page not updating with database
- Why am I timing out when using the Menu Editor?
- 500 internal server error on wp-admin only
- Hide admin toolbar based on a query string
- Admin Top Bar Not Showing On Front End
- How can I POST or GET to the same admin page from which I am POST-ing or GET-ing
- Output the admin menu_position for each item
- avoiding the display of certain categories to certain user roles at content entry time
- How can I add a menu item to the admin area?
- Backend Checkboxes working – but not visual?
- WordPress Admin Menu Order for ‘admin.php’ pages
- Admin bar is disabled in front
- Give admin_menu permission to specific users
- Show all admin menus in a table
- Highlight active Admin Menu when added though add_menu_page
- Admin Bar Acting Up
- Show admin bar to editors with Buddypres
- Create WordPress Menu Item Without Linking to a Custom Page
- Can’t access dashboard after 4.8.1 automatic upgrade
- Signed-in as admin on just part of the site
- Simple CSS admin pagination
- Add item to admin bar as late as possible
- How to change the default url for ‘Posts’ link?
- Unsure how to add simple checkboxes that write to a small table to admin
- Add a link to the Admin menu
- Reference external file as a function
- Custom Div with links on Admin Bar
- Content is displayed under admin bar [closed]
- Admin menu link with variable
- Display admin sidebar into custom post pages if logged
- Add custom column to Users admin panel
- Sort pages in loop by admin’s page attributes order field?
- Edit “thank you for creating with WordPress” in version 3.3.1
- Get current active wp color scheme
- How to fix admin stylesheet muck-up? [closed]
- Turn off admin emails for new user registrations
- Adding custom Javascript to the head tag in Admin
- Replacing the List table of a Post Type
- Adding scripts to admin page in my theme
- Why adding Categories does not auto refresh in Backend while using my custom theme?
- How to notify the admin about something that happened during a cron job
- I’m receiving requests to change the admin email. How can this be happening?
- How to send little data between admin pages of my plugin?
- Set admin body to ltr on a rtl installation
- Can I mass change all admin emails for a multisite instance?
- WordPress admin area used to administer other site
- Add ‘Last Modified’ and Attachments (Yes/No) to WordPress Users Column
- Why can’t a custom postype be registered with “admin_init” hook?
- Add term of current custom post type to admin body class using admin_body_class
- Limiting Admin Backend Search to Title
- Include script files for admin submenu page
- Restrict access to admin
- solution to prevent specific admins from altering site contents
- WordPress Admin very slow
- Prevent users in the backend from seeing WP/Plugin notifications and update annoucements?
- How can I create multiple different admin roles with their own capabilities
- How to remove an item from menu bar’s +New menu based on User role
- Find out if post was just updated on post edit screen
- Wp-admin page not found following copy of site
- wordpress login loop after install
- How can I place a page link to the sidebar admin bar?
- How to remove certain feed from my dashboard in WP admin
- Hiding the media-new.php File URL option via jQuery
- 2FA for admin login only, is it doable?
- Add a user to edit the layout of a site