How to Title a WordPress Widget in JavaScript
The JavaScript language lets you dynamically set some properties for your WordPress widgets. One such property is the widget title, which displays in the user's browser. You use the JavaScript document.title function to personalize the widget's page title. You can use the function for a widget that can be viewed only in the dashboard, or a widget that displays when the user opens your blog.
Instructions
-
-
1
Right-click the WordPress widget file you want to edit. Select Open With, then click the PHP editor to open the file's code.
-
2
Create a JavaScript section for the plugin, if you do not already have JavaScript tags defined. Type the following tags to create a section for your widget:
<script type="text/javascript"> </script>
-
-
3
Set the title using the JavaScript document.title function. Place the following code in the JavaScript tags defined in Step Two:
document.title = "My Widget";
Replace "My Widget" with your own widget name.
-
1