S
S
simpleasthat2016-04-19 22:46:44
PHP
simpleasthat, 2016-04-19 22:46:44

How to display a variable in DOM?

Hello.
My knowledge of PHP is scanty, so please do not throw stones, I will try to describe the task in as much detail as possible.
I have the following function:

function theme_menu_extras( $menu, $args ) {
  if ( 'primary' !== $args->theme_location )
    return $menu;
  ob_start();
  get_search_form();
  $search = ob_get_clean();
  $menu  .= '<li class="right search">' . $search . '</li>';
  return $menu;
}

$search is the search input field. My task is to simply output it to the DOM for further manipulations, while the function above should remain unchanged, i.e. I gave it as an example. Tell me, please, how can I do it right? Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mr Crabbz, 2016-04-19
@Punkie

Where you use the function:
Only the $menu and $args variables should be replaced with the appropriate arguments.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question