SOHO创业

wordpress调用随机文章和随机推荐文章

wordpress调用随机文章的代码如下:

<?php
$query = array(
'post_type' => 'post',
'orderby' => 'rand'
);
$posts = new WP_Query( $query );
if ( $posts->have_posts() ) {
while( $posts->have_posts() ) :
$posts->the_post();
the_content();
endwhile;
}
wp_reset_query();
?>

wordpress随机调用置顶推荐的文章代码:

<?php
//获取置顶文章的ID串
$rand_id = get_option( 'sticky_posts' );
$query = array(
'post__in' => $rand_id,
'post_type' => 'post',
'orderyby' => 'rand',
'numberposts' => 2
);
$posts = new WP_Query( $query );
if ( $posts->have_posts() ) {
while( $posts->have_posts() ) :
$posts->the_post();
the_content();
endwhile;
}
wp_reset_query();
?>
Published
Categorized as 建站知识 Tagged ,

By SOHO

wowsoho.com是一个关注跨境电商、创业话题的网站。

WordPress外贸整站源码的实际应用技巧

     在WordPress外贸建站的过程中,源码的开发与运用是深入了解和定制网站的关键步骤。本文将分享一些… Continue reading WordPress外贸整站源码的实际应用技巧

把产品卖到中亚五国有没有必要建外贸独立站?

中亚五国包括哈萨克斯坦、吉尔吉斯斯坦、塔吉克斯坦、乌兹别克斯坦和土库曼斯坦。把产品卖到中亚五国有没有必要建外贸独立站?应该建什么语言的?

WP外贸建站轻松上手 建设你的全球化品牌

  在数字化时代,拥有一个强大的在线存在对于外贸企业而言至关重要。WordPress作为一个功能丰富、易于使用… Continue reading WP外贸建站轻松上手 建设你的全球化品牌

DTC独立站优势显著潜力无限

DTC(Direct-to-Consumer)独立站作为一种新兴的商业模式,具有显著的优势和潜力。

企业官网用复杂wordpress模板 就是老板挖坑埋自己

简洁实用的WordPress模板能够更好地满足这些需求,同时降低维护成本和风险。复杂模板虽然在搭建时可能看起来很强大,但长期来看,它们可能会给企业带来不必要的麻烦和成本。

8个中文AI大模型 人工智能时代来了

今日起,国内 11 家通过《生成式人工智能服务管理暂行办法》备案的 AI 大模型产品将陆续上线,面向全社会开放。