adsense

How to Automatically Link WordPress Articles





1. Log in to the WordPress dashboard from your wp-admin directory. Navigate to 'Editor' from 'Appearance' in the left-hand menu. Find the link to your single.php file under the 'Templates' heading on the 'Edit Themes' screen and click that to open the file.
2. Locate the end of the WordPress post loop, which looks like this:






3. Split the 'endwhile' and 'else' statements in to two separate lines:


4. Place your post navigation links between the 'endwhile' and 'else' statements. Here is the code:


5. Wrap the post navigation links in div tags so you can style them later. Add an ID name to each. Here is the code:






6. Format the post navigation links by adding parameters to the functions:
The first parameter controls the link's format; in this case, the text is a left-arrow quotation mark (double arrow) and specifies that the text is a link. Change '%title' -- this code outputs the title of the previous or next post -- to 'Go Back' or 'Last Post' if you like. Set the next parameter to 'true' instead of 'false' if you want to keep the links confined to the current post's category. You can add a number between the empty pair of single quotes to exclude one or more categories.
7. Save your changes by clicking the blue 'Update File' button. Copy and paste the post navigation codes and add them to any other single view template file, such as single-post_type.php.
8. Open the style.css file from the bottom of the right-hand side of the 'Edit Themes' screen. Add this code to the bottom of the file:#previous-post {float: left;}#next-post {float: right;}This CSS code puts the links on either side of the post pages, where your visitors will expect to find them. Update the file to save your changes.

Comments

0 Responses to "How to Automatically Link WordPress Articles"

Post a Comment

Popular Posts

About