WordPress.org

Ready to get started?Download WordPress

Forums

WP_Query issues with latest upgrade (1 post)

  1. sledgedesign
    Member
    Posted 1 year ago #

    I had a client upgrade WordPress after everything was working just fine on the older version, much to my dismay. In any case, most of my content was being displayed using a loop like the following:

    <?php
    		$recent_posts = new  WP_Query("order=DESC&category_name=slug" );
    		?>
    
                     <div id="promoted">
    			   <a>
    			   <?php
                               while ( $recent_posts->have_posts() ) : $recent_posts->the_post();
    				/*do some stuff here*/
    				endwhile;
    				wp_reset_postdata(); ?>
                             </a>
                     </div>

    [Please post code & markup between backticks or use the code button. Your posted code has now been permanently damaged by the forum's parser.]

    Unfortunately after the upgrade none of these queries and loops work anymore. I have gone through the codex and can't figure out where the syntax may have changed. The client's database was completely intact, so I'm stumped as to why this won't work any more. Oddly enough, the standard WordPress loop works in place of the above in most areas of the site, but I need to understand how I can specifically choose a category by name for pages on which multiple different loops are needed.

    Problem can be seen (unfortunately) live at openviewcinema.com. The sidebars and home are displaying the problem (no content); archive templates have the current standard wordpress loop implemented.

    Thanks in advance!

Topic Closed

This topic has been closed to new replies.

About this Topic