adsense

How to Use Script With WordPress





PHP Scripts
1. Go to your WordPress theme folder and open the 'functions.php' file on Notepad. If the theme does not have one, create a new file named 'functions.php.'
2. Type in your PHP script. For example:function myscript() {return 'WordPress rocks!';}

3. Define the shortcode to use when using the script on your WordPress blog. Add the following after your PHP script:add_shortcode('wprocks', 'myscript');Replace 'wprocks' with the name you wish to have for your shortcode and 'myscript' with the name of your PHP function.
4. Save your file and upload it to your website.
5. Log in to your WordPress site.
6. Go to 'Posts' and click on 'Add New.'
7. Switch to the 'HTML' tab and type in the shortcode:[wprocks]
8. Save the post. View it to see your script in action.
JavaScript
9. Open Notepad, paste your JavaScript code and save the file as a JS file. For example, type 'myjavascript.js.'
10. Log in to WordPress. Click 'Media' and 'Add New,' and select your JavaScript file to upload.
11. Copy the URL displayed in the 'File URL' field.
12. Go to 'Posts' and 'Add New.' Switch to the 'HTML' tab.
13. Type in the following code to load your JavaScript file:

Replace 'myjavascript.js' with the URL codeType in the code to call your JavaScript function. For example:


Save your post and view your page.

Comments

0 Responses to "How to Use Script With WordPress"

Post a Comment

Popular Posts

About