Just wanted to give an update. Someone was kind enough to show me how to update the code I posted above. It turned out to be quite simple (if you know what you’re doing!). So I have posted it below for anyone that wants to do something similar.
<?php $posts_per_page = get_query_var('posts_per_page'); ?>
<?php $paged = intval(get_query_var('paged')); ?>
<?php $paged = ($paged) ? $paged : 1; ?>
<?php $args = array(
'posts_per_page' => $posts_per_page,
'paged' => $paged,
'more' => $more = 0,
'meta_key' => 'views',
'orderby' => 'meta_value_num',
'order' => 'DESC',
); ?>
<?php query_posts($args); ?>
<?php if (have_posts()) : while (have_posts()) : the_post() ;?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
Related Posts:
- How to add “time” data this?
- Count post views in loop
- How to sort a loop after most viewed
- Get date of last update outside of loop
- Custom Loop and Infinite Scroll
- Loop that displays PARENT PAGE & CHILD PAGE & outputs GRANDCHILD PAGE title and content
- wp-admin redirecting to https, denying login
- wordpress loop for specific category
- Three different post types on homepage
- Add Incrementing ID to each paragraph in the_content
- Multiple posts with one loop iteration
- Transient not working for custom loops
- Custom Loop, Match Category with Page
- Display page of custom posts?
- include(locate_template) messing up the loop
- get_the_content not working in loop?
- Get link of inserted media file of post within loop
- If No Search Results, Show Posts from Alternate Search Query
- Loop – how to get previous/next post for first/last post?
- multiple loops with pagination on the same page
- Loop through all media library images and return those where caption contains the text carousel
- Custom search form to display users only
- Multiple loops on the same page removing post tags
- Pages inside a page (with thumbnails)
- How to make post content from each post display within the same div
- Displaying the last page of posts
- How to order posts by meta_value created inside loop?
- How to return only one instance of each, from the entire loop
- Problems with loop
- Repeating Loop on my Posts Page
- Combining action and filter?
- Shortcode with a foreach and arguments
- Calling & display certain product category loop and pagination on the homepage
- Detect if current page is front page within custom query
- Display Authors in a grid loop
- Infinite Scroll and DFP
- Sanitize Custom Field Value in Meta Query
- Default ‘post’ post type archive slug?
- show random image in loop if image is not set
- Get Page content to displayin Bootstrap Modal
- need help looping add_action in wp
- Does WordPress Loop have a function like Shopify’s cycle?
- Combine the results of two loops [closed]
- How to show more random posts if Tag has less than 3 posts
- How can I improve the performance of this query_posts loop?
- Add leading zero to current post display [closed]
- Distribute Gallery Images Every nth in Loop
- WordPress Image Slider Looping Title Not Working
- Output meta into arrays
- Is there any good reason for two CSS files to @import each other?
- Moving wordpress to different url/server creates redirect loop
- Second Loop Showing Only One Post on Single Post Page
- Pulling in featured image into default recent posts widget
- Random post link generator messes up the loop
- Modify loop output for a specific list of categories
- how can i order the category by date
- Change position of entry title
- Print the whole page?
- excerpt not showing up
- Pagination for two loops
- Announces with different formatting dependently on a number
- Override orderby to create list of users by custom meta_value
- Loop info in jquery Tabs – loop into a variable?
- Thumbnail Image Rounded Corners w CSS (or any other good method)
- Several loops in sidebar issues
- List page is showing 404
- Adding $args to wp_schedule_event() causes hook to add infinitely to WP Cron
- $post is undefined in wordpress loop [ajax]
- Duplicated tag in loop
- Insert content above an embedded video inside Wordress’ php the_content
- Loop only shows first two posts
- Why is my archive page looping through all but one post?
- Loop two different category WP_Query
- Use ACF Category Image for all Taxonomy Archive Views
- the loop printing post in one grid
- Check value of post meta within IF statement
- My WordPress installation doesn’t load correct template
- Work arounds for conditional checks inside the loop in search.php?
- Transient not working for external data
- adding tax_query to $query_string
- Get Sticky User in user loop based on user role
- Popular posts with Varnish ESI
- Querying posts from only one category and exluding the latest post
- Remove posts_orderby filter then add it back in
- the_title() Returns the page title instead of the post
- WP update_post_meta link loop
- query_posts ignores the argument
- Need some help with “the_widget()” function
- Conditional Check in The Loop’s Parameters
- How does the JSON API work to parse incoming JSON and fetch a post based on an ID?
- How to add excerpt in loop in Twenty Eleven theme?
- Exclude Authors based off date of last post
- Loop from another WP site onto mine
- Having issue with WordPress loop
- How to implement template file and the loop
- Show only posts from todays date [duplicate]
- How to add class to the last image of the last post in a loop
- Why did my most recent article fall behind an older one on my site?
- I make sticky post for my archive page for custom post type with ACF field and loop is not working
- Use Base-URL with Query-Loop