<?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
list of all articles in the current category in wordpress
<ul> <?php $singleurl = get_permalink($post_id); $cats = wp_get_post_categories($post->ID); if ($cats) { $args = array( ‘category__in’ => array( $cats[0] ), ‘showposts’ => 50, ‘caller_get_posts’ => 1 ); query_posts($args); if (have_posts()) : while (have_posts()) : the_post(); update_post_caches($posts); ?> <li<?php if(get_permalink($post_id)==$singleurl){?> class=”video-curry”<?php }?>><a href=”<?php%20the_permalink();%20?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a></li> <?php endwhile; else : ?> <li> Nothing</li> <?php endif; wp_reset_query(); } ?> ...
0
0
24
5 hosting control panels available on the market
cPanel This Linux based control panel is placed in the first category of control panels due to its high popularity and professional features with easy operations. It has a simple and understandable GUI, awarding it our recommendation for Linux-based web...
0
0
8
Get all WordPress category names and IDs
function show_category(){ global $wpdb; $request = “SELECT $wpdb->terms.term_id, name FROM $wpdb->terms “; $request .= ” LEFT JOIN $wpdb->term_taxonomy ON $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id “; $request .= ” WHERE $wpdb->term_taxonomy.taxonomy = ‘category’ “; $request .= ” ORDER BY term_id asc”; $categorys =...
0
0
5
Displaying the Last Post Date in WordPress
To display the date of the last post in WordPress, you can use the get_lastpostdate() function, which retrieves the date and time of the last post in the WordPress database. Here’s how you can display it in your theme files...
0
0
7
Comments (0)