html - PHP - Get text from a text field to put in widget -


Need some help! I have a customer who needs the latest news section on my website, I have created a div to keep 'visit', although in order to edit the content (text in the latest news box) my client will have to go to widget menu And to edit the raw HTML code, which I do not want to do.

I have thought a solution, did some research, but a little bit stuck about what to do next.

I was currently thinking of using the plugin to change the text widget using the code given below;

  & lt ;? Php if (is_single () & amp; amp; Get_post_meta ($ post-> ID, 'NAME', is true)) echo get_post_meta ($ post-> ID, 'NAME' is true); }? & Gt;  

To capture a plain text textarea where my client can go, is it possible to edit text only? I was thinking of putting one more button on the left side of the admin panel called 'Latest News' where they can click and then it shows a texture and a submit button.

Is this interim?

In advance thanks

It's easy, you have an input text or a Texteria The form should be:

   

and then in the action.php page you get the contents of this text field using $ _ POST :

can do. $ content = $ _POST ['text'];

Finally, you can use this text by javascript to action.php :

  lift; Script & gt; Var text = '& lt ;? Php $ content; ? & Gt; '; Document.getElementById ('WidgetSpaceID'). InnerHTML = Text; & Lt; / Script & gt;  

Reaction to more specific problems.


Comments