wordpress - Wrap Div around WP Posts / Pages function -


I need a function for WordPress because I have to wrap a post / post title at the top of the page.

The title looks like this:

  & lt; H1 class = "entry-title" & gt; Test Post & lt; / H1>   

So I need to do something like this:

  & lt; Div id = "mydiv" & gt; & Lt; H1 class = "entry-title" & gt; Test Post & lt; / H1> & Lt; / Div & gt;   

Any ideas if I can do this?

This is the correct way, you need to add filters, enter the following code in function.php or your Plugin Page:

  add_filter ('the_title', 'title_div_wrapper'); Function title_div_wrapper ($ title) {$ title = '& lt; Div id = "mydiv" & gt; & Lt; H1 class = "entry-title" & gt; '. $ Heading. ' & Lt; / H1> & Lt; / Div & gt; '; $ Heading back; }   

will now have the post title output () with the DIT wrap.

For more detail, read the WordPress documentation @ bodi0

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -