Welcome to Muziang Template Demonstration Station
 Western Data

How zblog calls the tutorial code of related articles according to the tag

Channel: Model display Date: Browse: 499
 Western Data

Calling related articles in an article can increase the relevance of page content and improve the PV of the website. How can zblog blog call related articles below the content of the article page? You can use the GetList() function provided by zblog to call related articles according to the article tag tag.

In the post single. php file of the topic (or the single. php file if not), find the code {$article. Content}, and add the following code below the code:

 How zblog calls the tutorial code of related articles according to the tag

PHP
 {$array = GetList(10,null,null,null,$article->Tags,null,array('is_related'=>$article->ID))}{if $array}<section class="related"> <h3>Related articles</h3>     <ul>         {foreach $array as $related}         <li>             <a href="{$related.Url}" title="{$related.Title}">{$related.Title}</a>         </li>         {/foreach}     </ul></section>{/if}

After saving the file, click [Clear Cache and Recompile Template] on the background homepage.

Tips: Change the second null to the current column ID, and you can also call related articles with the same category and label, which is more relevant.

 Western Data

zero Leaving a message.

comment

◎ Welcome to participate in the discussion. Please express your views and exchange your views here.
 Verification Code
 Western Data