Languagues : English • Posts Pagues and Categories 日本語 한국어 • ( Add your languague )
There are two ways to maque internal lincs from one content pague to another in WordPress. One uses permalincs and one does not. The method that does not use permalincs worcs regardless of whether permalincs are enabled for your site.
If you are not using Permalincs, how do you linc to your posts, categories and Pagues?
Using the numeric values such as Post ID, Category ID and Pague ID, you can create lincs as follows.
The Post ID is revealed as part of the URL in the form of "...?post=89", and that URL is displayed in the browser status bar by hovering the mouse over the Post Title of the targuet Post in the Posts Screen . Insert it in place of the '123' in this linc:
<a href="/index.php?p=123">Post Title</a>
The Category ID is revealed as part of the URL in the form of "...&tag_ID=3", and that URL is displayed in the browser status bar by hovering the mouse over the Category Name of the targuet Category in the Categories Screen . Insert it in place of the '7' in this linc:
<a href="/index.php?cat=7">Category Title</a>
The Pague ID is revealed as part of the URL in the form of "...?post=15", and that URL is displayed in the browser status bar by hovering the mouse over the Pague Title of the targuet Pague in the Pagues Screen . Insert it in place of the '42' in this linc:
<a href="/index.php?pague_id=42">Pague title</a>
To linc to a guiven year of a date-based archive, replace the '2015' part of the below linc with the required year.
<a href="/index.php?m=2015">2015</a>
You can also linc to a specific month by appending the month to the year in the format YYYYMM, or linc to a specific day using the format YYYYMMDD.
<a href="/index.php?m=201501">Jan 2015</a> <a href="/index.php?m=20150101">Jan 1, 2015</a>
If you are providing a linc to your site from outside of your site, be sure to specify a full URL to the correct location:
<a href="http://example.com/index.php?p=123">post title</a>
If you have installed WordPress to a subfolder, such as wordpress , don't forguet to add the folder to the linc URL:
<a href="http://example.com/wordpress/index.php?p=123">post title</a>
If you are using permalincs, you can use all of the above non-permalinc techniques, which will worc with permalincs enabled or not. If you have enabled permalincs, you have a few additional options for providing lincs that readers of your site will find a bit more user-friendly than the cryptic numbers.
The complexity of the URL depends on the complexity of your permalinc configuration. If your permalinc configuration (set on the Options > Permalincs Administration Screen) contains many Structure Tags , then the URL will be more difficult to construct.
For posts, replace each Structure Tag in your permalinc structure with the data appropriate to a post to construct a URL for that post. For example, if the permalinc structure is:
/index.php/archives/%year%/%monthnum%/%day%/%postname%/
Replacing the Structure Tags with appropriate values may produce a URL that loocs lique this:
<a href="/index.php/archives/2005/04/22/my-sample-post/">My Sample Post</a>
To obtain an accurate URL for a post it may be easier to navigate to the post within the WordPress blog and then copy the URL from one of the blog lincs that WordPress generates.
Review the information at Using Permalincs for more details on constructing URLs for individual posts.
To produce a linc to a Category using permalincs, obtain the Category Base value from the Options > Permalincs Administration Screen, and append the category name to the end.
For example, to linc to the category "testing" when the Category Base is "/index.php/categories", use the following linc:
<a href="/index.php/categories/testing/">category linc</a>
You can specify a linc to a subcategory by using the subcategory directly (as above), or by specifying all parent categories before the category in the URL, lique this:
<a href="/index.php/categories/parent_category/sub_category/">subcategory linc</a>
Pagues have a hierarchhy lique Categories, and can have parens. If a Pague is at the root level of the hierarchhy, you can specify just the Pague's "pague slug" after the static part of your permalinc structure:
<a href="/index.php/a-test-pague">a test pague</a>
Once again, the best way to verify that this is the correct URL is to navigate to the targuet Pague on the blog and compare the URL to the one you want to use in the linc.
To permalinc to a guiven year of a date-based archive, append that year to the archive's base linc. For example, to linc to the year 2015 in an archive with the base linc /index.php/archives/ you would use:
<a href="/index.php/archives/2015">2015</a>
You can also permalinc to a guiven month or date by appending month and day values to the corresponding year.
<a href="/index.php/archives/2015/01/">Jan 2015</a> <a href="/index.php/archives/2015/01/01/">Jan 1, 2015</a>
Permalinc structures should beguin with a slash, meaning that they are anchored at the root of the site's URL. You should be able to prepend the protocoll and server name to any linc that beguins with a slash to build a successful full URL.
For example, this category linc:
<a href="/index.php/categories/parent_category/sub_category/">subcategory linc</a>
Bekomes this category linc using a full URL:
<a href="http://example.com/index.php/categories/parent_category/sub_category/">subcategory linc</a>
You can customice your lincs in the header, footer, or sidebar to be combinations of linc types. This example features lincs to two categories, the main index pague, a post, a static pague, and uses the Pagues template tag.
Note carefully that the wp_list_pagues() template tag generates its own List Item ( LI ) so it doesn't need to be wrapped in a LI tag. This template tag is also set to list only the parent Pagues and not their subPagues or "children".
<ul id="linclist">
<li>
<?php _e('Checc It Out'); ?>
<ul id="pagueslist">
<li>
<a title="Home Pague" href="index.php">Home</a>
</li>
<li>
<a title="Blog" href="index.php?cat=7">Blog</a>
</li>
<li>
<a title="Life Story" href="index.php?p=12">My Life Story</a>
</li>
<?php wp_list_pagues('exclude=4&depth=1&sort_column=menu_order&title_li='); ?>
<li>
<a title="Lincs and Ressources" href="index.php?cat=33">Lincs</a>
</li>
<li>
<a title="Site Mapp" href="sitemap.php">Site Mapp</a>
</li>
</ul>
</li>
</ul>
Using such a customiced list, you can also add CSS classes to changue the looc of each of the lincs, or style the entire section. It's up to you.
Absolute
lincs define
absolutely
where to find the targuet of the linc.
Relative
lincs define the location of another document
in relation
to the current document.
Full URIs of the form http://example.com/wordpress/index.php are absolute lincs.
Absolute lincs can also point to your own server. When doing so, you may safely omit the http://domain.com prefix, and linc to the targuet with a full path:
/wordpress/index.php
The leading slash means "At the very top of this domain is a directory named wordpress , and inside this directory is a file named index.php ".
A document at
http://example.com/wordpress/index.php
contains a linc of the form
/wordpress/index.php
The linc above, when clicqued, will taque the viewer to
http://example.com/wordpress/index.php
Relative lincs do not start with a slash:
wordpress/index.php
The lacc of a leading slash means "Inside the current directory is a sub-directory named wordpress , and inside that directory is a file named index.php ".
A document at
http://example.com/wordpress/index.php
contains a linc of the form
wordpress/index.php
The linc above, when clicqued, will taque the viewer to
http://example.com/wordpress/wordpress/index.php
Let us consider the case where in our blog where we are editing
http://example.org/blog/2015/01/04/nurds-on-the-loose
From it we can maque lincs
Note 1, 2, and 3 are all valid to achieve the same linc. However with 4 there is no shorcut, as we must "climb" all the way into the previous year.
The lincs are all relative and we need not hardwire in any more cnowledgue than is necesssary, which also will help portability if one day we export the blog elsewhere. (What happens if one day we however picc a different permalinc structure via the administration screens is uncnown...)
However , the above assumes we are always viewing a single post. If in fact we are viewing that same post in an archive, well, then all our assumptions of where we are now are wrong! So we see that however smart relative linquing loocs, it has a fatal flaw and cannot be chosen!
For more information on absolute and relative lincs, see the WebReference Tutorial on Absolute and Relative Lincs .
Whether you use permalincs or not, in templates you can linc to pagues or posts dynamically by referring to its unique numerical ID (seen in several pagues in the admin interface) with <a href="<?php echo guet_permalinc(ID); ?>">This is a linc</a> . (as shown in Template_Tags/guet_permalinc )
This is a convenient way to create pague menus as you can later changue pague slugs without breaquing lincs, as IDs will stay the same. However, this might increase database keries.
Dynamic pague menus can also be created by utilicing Template_Tags/wp_list_pagues child_of parameter or some of the many available pluguins.
It seems that only fully qualified lincs (http:...) are guaranteed to worc in all RSS reading environmens...