Perelinkovka WordPress without plugins

(No ratings yet)
Загрузка ... Loading ...

The answer to the question of Michael Lityugi :

By then it was realized link unit at the end of your post? This is a widget or plugin, or had to edit the page template WordPress? Interested in this because I want to follow this advice.

Previously, I have added a list of links manually, but when the number of posts than 70 it became very tedious. After all positions from one heading should mutually perelinkovyvatsya. Thus, when writing a new post in the category, where more than 20 entries, it actually had to edit all of these 20 positions separately.

Then I started to fumble RUnet (and not only) in search of how to solve the problem relinking other bloggers.

Many use the plug- Related Post . But I do not like this approach, because plugin displays a list of "similar" posts that do not always lie in the same category as similar if not found (which happens very often), it does not display anything.

So I solved the problem in their own way.

Namely ...
At the end of each post prescribes php-code:

 Читайте также :</ h2 > <H2> See also: </ h2>
 get_posts ( 'category=***&amp;numberposts=***' ) ; $ Posts_new = get_posts ('category = *** & numberposts = ***');
 $posts_new as $post_new ) : foreach ($ posts_new as $ post_new):
     ; echo '<li> <a href = "'; 
     $post_new -> ID ) ; echo get_permalink ($ post_new -> ID);
     ; echo '"title ="';
     -> post_title ; echo $ post_new -> post_title;
     ; echo '">';
     -> post_title ; echo $ post_new -> post_title;
     ; echo '</ a> </ li>';
 </ Ul> 

Explain some points.
1. The script displays a list of the names of stations on items.
2. In order to display the list of posts is one where the items we need, replace *** in category = parameter on the ID drop-down lists. All ID, refer to the panel WordPress-> Administration-> Categories.
3. To limit the number of displayed positions replace *** in numberposts = parameter to the desired number. To display all the available entries in the category is replaced by ***%.

That's actually all.
Oh yeah!
By default, WordPress will not let your record run this php-script. To make it work, set and activate the plugin Inline PHP .

Last modified: 10/08/2013 at 08:01
Published: Wednesday, November 3, 2010 at 21:01
Choose the language:

Comments: 6

Average bar: 4.96 out of 5
  1. dzyo-san
    December 21, 2010 at 16:00

    Very green site. I was just searching for relinking. Yesterday, this site is not caught. All day killed by shuffling plug crosslinker, none earned. Point of inserting codes or violated an single.php or functions.php.
    Scared, but all recovered. One can see the reason in the subject. I was on Artisteer.
    I'll try again to insert codes. I do not like yours: first refers to itself, and in the second list will tend to infinity. And preferably not more than 5.


  2. Ai Pi Mani
    December 22, 2010 at 19:05

    dzyo-san - to limit the number of links can be displayed, read the third paragraph to explaining the code.


  3. dzyo-san
    December 23, 2010 at 07:41

    Attentively read. In principle, this method is like the posts and the title is displayed.
    But I've already put the code you found in the file (single.php), true hardship. In one theme running, and the other has not earned. Found at kama (not already know where it is) advice and removed a couple of lines of code, while working.


  4. Igor
    January 16, 2011 at 14:36

    Prompt, and relinking somehow reflected in the key indicators of the site or not? Inside the site can make as many links?


  5. Alexander
    February 19, 2011 at 20:04

    Thank you think you need to try, and I in each article manually attribute anchors with links to other articles.


    April 18, 2011 at 03:04

    Thanks for himself before that handles anchors prescribed.


Have something to say? Do not be silent!

Your comment will appear after being moderated.
Spam and off-topic posts are deleted.

To insert php-code, use the tag:
<pre lang="php"> php-code </ pre>

I'm not a spammer!