Wordpress related article function code example
<?php $posttags = get_the_tags(); $category = get_the_category($post->ID); $the_cate_id = $category[0]->term_id; $xg_array = array(); if ($posttags) { $tags = ''; foreach ($posttags as $tag) $tags . = $tag->term_id . ','; $args = array( 'post_status' => 'publish', 'tag__in' => explode(',', $tags), 'post__not_in' => explode(',', $post->ID), 'caller_get_posts' => 1, 'orderby' => 'comment_date', 'posts_per_page' => 10, ); $xg_array = query_posts($args); } if (count($xg_array) == 0) { $args = array( 'post_status' => 'publish', 'cat' => $the_cate_id, 'orderby' => 'comment_date', 'posts_per_page' => 10, ); $xg_array = query_posts($args); } foreach ($xg_array as $related) { echo ' <li><a href="' . get_permalink($related->ID) . '" title="' . $related->post_title . '">' . $related->post_title . '</a></li>'; } wp_reset_query(); ?>
Can't find a tutorial that can solve your problem?
-
Charging zblogphp template Tianxing Studio ppt download template is suitable for sites with resources to sell vips one 2019-10-03 fifteen thousand two hundred and forty-nine Price: one hundred and ninety-nine Online purchase -
Wordpress template Tianxing Studio wordpress download station theme is applicable to software/app/game and other download stations zero 2022-05-06 sixteen thousand six hundred and ninety-five Price: three hundred and fifty-five Online purchase -
Charging zblogphp template Tianxing Studio zblogphp enterprise theme 6 Self configurable atmosphere zblog enterprise theme two 2018-06-26 fifty-one thousand seven hundred and fifty-six Price: two hundred and fifty-eight Online purchase
Related recommendations
-
The number of articles displayed per page is different for different categories of wordpress 04-24 -
Wordpress gets the top-level classification ID of the current classification and calls the subcategory 04-15 -
Functions and Switches of Wordpress Development Mode (DEBUG) 04-02 -
Wordpress obtains the website title of the previous article and the next article separately 03-22 -
The post returns 404 after calling "wp blog header". The cause and solution of the problem 03-05 -
The code and steps for creating a new data table in WordPress 03-04 -
Solution to the problem that Wordpress calls the article content label and the article content does not break lines 02-22 -
The solution to the time zone problem when wordpress uses strtotime 02-17 -
Wordpress related article function code example 02-13 -
Wordpress calls specified field article data+specified field sorting 12-30
welcome you Comment: Cancel Reply
-
Zblog Enterprise Theme -
Zblog image theme -
Zblog resource topic -
Zblog CMS topic -
Wordpress template -
Zblog video theme -
Zblog Taobao guest theme -
Zblog navigation topic
Select a theme?
-
Latest articles -
Hot article ranking -
Most Comments
-
one Tianxing Studio multilingual translation plug-in can automatically translate up to 12 languages for foreign trade sites 06-23 -
two Detailed steps and screenshots of Youdao Cloud Translation to obtain appid and seckey 06-22 -
three The asynchronous notification page after Alipay payment prompts "Payment signature verification failed, please contact the administrator! "Causes and solutions 05-08 -
four Screenshot of AliCloud OSS configuration item acquisition steps, including ID and Secret, regional node endpoint, storage space bucket and resource access domain name 04-14 -
five The cause and solution of verification code error is always prompted in the background of zblog login 03-01 -
six Zblog uses api to submit post data, prompting the reason and solution of 419 error 02-23 -
seven Tianxing Studio 2025 Spring Festival Holiday Announcement 01-25 -
eight Tutorial of setting "WeChat notification" function of Tianxing user center plug-in 11-09 -
nine Alibaba Cloud 2024 Double 11 Event is recommended to participate through the website link and give away vouchers on the website 11-05
-
Label aggregation -
×1 Small leather panel ×1 Limited time promotion ×1 object-fit ×1 Zblog module ×1 Responsive Navigation Bar ×1 Zblog tab ×1 Issued on the same day ×1 Upload pictures ×1 Right fixing ×1 red ×1 Security Group Configuration ×1 emlog6.0 ×1 a298t ×1 fall ill ×1 Number of zblog articles ×1 Simple enterprise template ×1 Merchant private key ×1 Zblog administrator ×1 Zblog mall plug-in ×1 module
Latest comments
-
Visitors 111 07-06 In short, it is not a free lunch. It is difficult to develop without taking the Z mode Commented on: Notes on zblog copyright -
Tianxing Studio 02-08 No restrictions Commented on: Tianxing Studio zblog Taoke theme is suitable for promoting websites with content -
visitor 02-08 Do you think the users of zblog Taoke must be enterprises? Commented on: Tianxing Studio zblog Taoke theme is suitable for promoting websites with content -
kevel 11-09 Guys, throw away some demo stations other than the authors. I want to see your layout settings Commented on: Template of zblog navigation station of Tianxing Studio with news, pictures and Taoke module -
Interesting life 10-22 I have always wanted to develop the functions of zblog. I don't know whether the application of zblog is enough Commented on: Code of zblog calling the latest comment (the latest message)