try to use get_posts instead , as I read in http://codex.wordpress.org/Function_Reference/query_posts
you can use this code:
global $post;
$args = array('posts_per_page' =>3,'category' => 3 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :
setup_postdata($post);
the_title()
endforeach;
wp_reset_postdata();
Regard’s.
Related Posts:
- Build a content and excerpt grid loop with paging and options for # of posts
- Alter query on edit.php
- How to order posts by modified date without using ‘query_posts’?
- Getting movie and serial on actor page
- Two posts in same div – WP loop
- how to display active, upcoming and past event with featured listing with pagination
- Include a specific post to the query_posts and remove it if it is already in the returned list
- Insert all post IDs in new database table
- Exclude posts from homepage having a specified tag
- Working with query_posts ( arrays and query strings)
- Can’t search posts using WP_QUERY inside AJAX Function
- Displaying the last post on static homepage
- Using loop pagination on single.php
- Logged in user ID as post ID
- Sort query_posts for Parent Pages to menue order or the count?
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- Sort by page information by Ascending Numbers
- How to list posts from a plugin taxonomy?
- Counting Search results, and displaying the offset per page
- How to get post ID in a Page?
- Pagination broken on is_front_page()
- change the default order of posts only for specific categories
- Posts are not looping through correctly
- limit number of post for achive page
- Saving a post ID to use in a form elsewhere on website
- posts_nav_link pulling in multiple post types
- Remove Post if Advanced Custom Field is checked to fix paging
- How to break up php code to avoid echo
- Limit the number of child pages
- search.php to search only the post title
- Hot to check if new posts have been published since page load and notify online users?
- WordPress create custom XML RSS feed template
- WordPress sorting posts by date and title using a dropdown
- Is there anyway I can call the year once?
- How to only fetch certain Tag ID’s
- Div Missing In Custom Loop Query
- Create a hierarchical loop at predefined markup requirements
- How to exclude post from being queried based on custom meta value
- Automatically create a loop for post ID
- Query specific posts per user selections from dropdown menus
- Dropdown Menu for Query_Posts
- Custom query_posts() parameter
- Does wp_query and query_posts affect website performance? [duplicate]
- Pagination in category.php not functioning
- How to modify this function to exclude also the post belonging to a specific category?
- /page/2/ redirect to 404
- How do I exclude the current post from the upcoming post query
- Remove update nags for non-admins [duplicate]
- Are WordPress Heartbeat API ‘beats’ staggered or do they occur simultaneously for all users?
- Integrating WordPress to my website, while keeping my own authentication system
- Update Custom Field on Imported Post Creation
- Using a javascript file to access a get posts array
- Change title and meta description in included page (not template)
- Get first two paragraphs inside one div, and then get the rest under another?
- spliting posts into two columns
- Page Reloads Before AJAX Request Finishes
- I can’t get my custom widget area to show on my WordPress site
- Link for Most Recent Post
- wp-load Without Loading the plugins
- Remove posts after a given amount of time
- How to load a template-part based on a url wildcard?
- Customising the search function?
- Create an if is_page statement based on parent page
- Problem with custom plugin using AJAX to pull info from php file
- Append query string to all URL’s
- get post content of particular post by url
- Convert WordPress date format to jQuery UI Datepicker format
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- WordPress Ajax Always returning 0
- Deleting Certain terms from appearing on the front end as links
- Usage of call back function of add_meta_box()
- Menu Items fail to save correctly, cause reset of related page metadata
- How do I add more options to the post-new.php page?
- Dropdown menu for categories
- Four posts per row [closed]
- update_post_meta() not saving data inside of save-post filter
- Genesis / custom template page / setting the page title and meta desc
- Why in this WordPress theme I can’t see the Main Menu?
- Front end file upload returning wrong attachment url
- Restrict post to current user in postmeta
- Database SQL query error
- MYSQL TIMESTAMP when adding DATE_FORMAT then the output is blank, PHP conflict?
- How can one safely add html code to a wordpress theme header file?
- Plugin won’t output characters with diacritics properly
- WooCommerce is_product_category() not working
- ACF relationship on user profile page used for allowed access
- Retrieving and Displaying Data From a Table
- Error `this set of changes has already been published`
- Where does php code to load data go?
- How to locate parent theme functions and add functions to my wordpress child theme?
- Adding product permalink on admin order page throwing error
- How to create dynamic templates?
- How to create an unordered list of images separate from the content
- How to add delete, approve, spam Links to Comments
- Gravity Forms on submit return value on same page
- Showing the authors username and bio on custom author.php
- Help with my first Metabox helper class
- Splash pages on a high traffic site
- Fatal error: Uncaught Error: Call to undefined function wp_nav_menu()
- AJAX WP_Query’s order and orderby parameters not working