<?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-How to create a Taxonomy?
Here is an example of registering a “people” taxonomy function people_init() { // create a new taxonomy register_taxonomy ( 'people', 'post', array( 'label' => _('people'), 'rewrite' => array('slug' => 'person'), 'capabilities' => array( 'assign_terms' => 'edit_guides', 'edit_terms' => 'publish_guides', )...
0
0
7
How to Fix WordPress Memory Exhausted Error
There are a few possible reasons why this error could occur. Therefore, there are multiple methods you could apply to try and fix it. Method 1 Try adding this line to your wp-config.php file: define(‘WP_MEMORY_LIMIT’, ‘128M’); To do so, follow these...
0
0
10
WordPress display related articles
WordPress display related articles <?php $tags = wp_get_post_tags($post->ID); if ($tags) { $first_tag = $tags[0]->term_id; $args=array( ‘tag__in’ => array($first_tag), ‘post__not_in’ => array($post->ID), ‘showposts’=>10, ‘caller_get_posts’=>1 ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <li><a href=”<?php the_permalink()...
0
0
2
WordPress-loading scripts and styles
If you only import style.css, I can put this on the top of the head <link rel="stylesheet" href="<?php%20echo%20get_stylesheet_uri();%20?>" type="text/css" media="screen" /> If you add other styles, then add another one on the top of the head <link rel="stylesheet" href="<?php%20echo%20get_template_directory_uri();?>/bootstrap.min.css"> Another...
0
0
2
Comments (0)