Skip to content

Instantly share code, notes, and snippets.

@rabinkumarpal
rabinkumarpal / gist:9143ec6fb0bcca86de2631c965ccf437
Created January 14, 2024 05:54 — forked from kosinix/gist:5354637
Get month names using a for loop and PHP date function.
<?php
for($m=1; $m<=12; ++$m){
echo date('F', mktime(0, 0, 0, $m, 1)).'<br>';
}
// Start of Selection
// Initialize the arguments for the WP query to fetch various post types
$args = array(
'post_type' => ['post', 'session', 'resource', 'video'], // Define post types to query
'posts_per_page' => -1, // Set to '-1' to fetch all posts. Replace with a specific number if needed
'order' => 'DESC', // Order by descending to get the most recent or viewed first
// You can add more arguments here as per your query requirements
);
// Retrieve the most viewed posts using a function provided by the Post Views Counter plugin