adsense

How to Embed an Image in a Default Theme of a WordPress Blog Page





1. Log in to the WordPress dashboard from the 'wp-admin' directory of your website. Navigate to 'Appearance' from the left-hand menu.
2. Check that the default theme is listed under 'Current Theme.' Depending on your version of WordPress, the name of your default theme is the year of its release spelled out into words like 'Twenty Ten' or 'Twenty Eleven.' Look for the theme under 'Available Themes' if it is not your current theme, and click the 'Activate' link.

3. Click the 'Editor' link to load the 'Edit Themes' screen. Open a template file for the theme by clicking its link under the 'Templates' header. For example, to embed an image in the blog's index, load 'loop.php' into the editor.
4. Add the HTML code for your image first. Here is an example:
Replace 'images/mypic.png' with the path and file name of your image that you want to embed. Change 'My Pic' to the alternative text that you want to display when the image fails to load. Screen readers for the blind also use this text, so make your alternative text useful.
5. Convert the file path to your image to a path that WordPress can use. Use the template tag 'bloginfo()' in the file path to make this work. Give 'bloginfo()' a value of 'template_directory' so the tag loads the full path to the template's directory on your server. Here is the code:
/images/mypic.png' alt='My Pic' />No matter where you install WordPress or name your theme directory, 'bloginfo('template_directory');' will find the correct path. Because 'images' is a directory under the main directory of the theme, WordPress can now find your image.
6. Click the blue 'Update File' button when you finish embedding your image. No matter how you change your content in a page or post, this image will still appear on the pages or posts that use the template you just edited.

Comments

0 Responses to "How to Embed an Image in a Default Theme of a WordPress Blog Page"

Post a Comment

Popular Posts

About