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外贸建站优化新技巧 提升网站性能

  在外贸业务中,一个高性能的网站对于吸引国际客户和提升用户体验至关重要。本文将介绍一些最新的WordPres… Continue reading WordPress外贸建站优化新技巧 提升网站性能

工厂老板应建立与产品核心词相关的站群网站

工厂老板建立与产品核心词相关的站群网站的必要性与优势分析

WMD独立站与DTC独立站有什么区别

如果你的目标是低成本快速启动,WMD模式可能更适合;如果希望建立长期品牌价值,DTC模式是更好的选择。

SEO模板网站的wordpress主题最适合google外贸SEO

选择适合您外贸网站的WordPress主题时,考虑上述因素将帮助您创建一个不仅美观,而且对搜索引擎友好的网站,从而提高您的外贸业务可见性和转化率。

实现wordpress一篇文章只允许同一IP评论一次

让一个IP只能评论一次

给wordpress添加自定义字段的分类筛选功能

这段代码创建了一个简单的筛选表单,用户可以在其中输入自定义字段的键和值,然后点击“筛选”按钮来提交表单。