Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show view in #wp-content div of the wordpress admin dashboard ? #27

Closed
temuujina opened this issue Oct 7, 2021 · 1 comment
Closed
Assignees

Comments

@temuujina
Copy link

There is a #wpwrap and #wpcontent divs in body of the wordpress html.

<div id="wpwrap">
  <div id="wpcontent">
     ``
  <div>
<div>

When I call this function
$this->view->show('circulation.circulation', [] );

my view file which is .php file appears just below the body tag where is above the #wpwrap div.
How to show view .php file in #wpcontent div ?

@amostajo amostajo self-assigned this May 2, 2022
@amostajo
Copy link

amostajo commented May 2, 2022

There are two ways to do it.


OPTION 1) Using global method

If you are using a theme, call the theme() global method:

<?php theme()->view( 'circulation.circulation' ); ?>
<div id="wpwrap"><div>

If you are using a plugin:

<?php getBridge( '[PLUGIN NAMESPACE]' )->view( 'circulation.circulation' ); ?>
<div id="wpwrap"><div>

OPTION 2) By adding a custom hook

You need to add a WordPress action hook above your div, for example:

<?php do_action( 'above_wpwrap' ); ?>
<div id="wpwrap">
  <div id="wpcontent">
     ``
  <div>
<div>

Then use a controller/view handler with following command:

php ayuco add action:above_wpwrap view@circulation.circulation

@amostajo amostajo closed this as completed May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants