How to Import Variables in Wordpress

The WordPress application includes global variables you can import and display in your blog webpages. You must use the PHP coding editor in the WordPress dashboard to add the global variables to the page code. You use these variables and the associated PHP code when you build your own WordPress plugins or templates. All WordPress installations use the same global variables, so you know the code works on each version of WordPress.

Instructions

    • 1

      Open the WordPress dashboard and log in to the interface using your admin user name and password.

    • 2

      Click the "Appearance" link in the left panel to expand a list of options and choose "Editor" to open the editor.

    • 3

      Click the page you want to edit on the right side of the editor to open the page in the raw PHP mode. You can edit your code and import variables in this editor.

    • 4

      Import the WordPress variable you want to display on the page. For instance, if you want to display the author for the post, add the following statement to your code:
      <?php the_author_firstname(); ?>

    • 5

      Click "Update Page" at the bottom of the editor to save the changes. The changes will take effect immediately.

    • 6

      Click your blog name at the top of the dashboard to open the blog in a new tab and view the changes in your browser.

Related Searches:

References

Comments

Related Ads

Featured