<?php
$rand_posts = get_posts(‘numberposts=10&orderby=rand’);
foreach( $rand_posts as $post ) :
?>
<li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li>
<?php endforeach; ?>
wordpress display random articles
Related Articles
WordPress functions.php-Add a Sidebar
Adding a Sidebar Our theme also doesn’t have a sidebar (widget area), let’s fix that now. First, we need to register the sidebar in functions.php: function my_custom_theme_sidebar() {register_sidebar( array( ‘name’ => __( ‘Primary Sidebar’, ‘my-custom-theme’ ), ‘id’ => ‘sidebar-1’,) );...
0
0
5
What to do if the WordPress blog changes the site address (URL) and cannot log in?
When you change the site address of the wordpress program and save the settings, if you find that you wrote the wrong address and want to change it, you will find that you can’t log in at all. You may...
0
0
21
WordPress displays articles in a specified category
<?php $posts = get_posts( “category=4&numberposts=10″ ); ?> <?php if( $posts ) : ?> <ul><?php foreach( $posts as $post ) : setup_postdata( $post ); ?> <li> <a href=”<?php the_permalink() ?>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(); ?></a> </li> <?php endforeach; ?> </ul>...
0
0
21
WordPress displays subcategories of the current category
When making a corporate website, you need to list the corporate product categories in the sidebar of the website. If the company website has many product items, you need to set up secondary categories or subcategories. How to display subcategories...
0
0
34

Comments (0)