The WordPress wpdb class is a little different than the normal way of querying in that you run “vanilla” database queries.
You can see documentation on the wpdb class on the WordPress docs: http://codex.wordpress.org/Class_Reference/wpdb#Run_Any_Query_on_the_Database
Also, in regard to your code, you should be able to change the line here:
$originaldb->query_posts( 'posts_per_page=1' );
To something like this:
$results = $originaldb->get_results( "SELECT * FROM $wpdb->posts LIMIT 1" );
This will provide you with an array of posts that you can then process with a loop:
if($results):
foreach($results as $post): setup_postdata($post);
// do stuff with normal wp template tags
endforeach;
else:
// no posts
endif;
Related Posts:
- Maximum number of posts per page before affecting performance?
- Print Current Post Index number within Loop
- Separate Database Tables For Different Post Types
- rewind_posts() – what actually the use of it, and where using is required or preferred?
- How to show list of posts by author and category?
- Override the default number of posts to show for a single loop?
- WordPress Number of Posts Not Changing With posts_per_page
- Find most recent authors
- Get the author of the latest revision
- Strange switch_to_blog() issue
- Multiple loops in same page, without duplicate content
- loop not displaying posts on custom template page
- How to Display Post View Count
- Exporting Data from WordPress into a flat table
- Displaying the number of posts in a custom loop (without including the number of posts of a loop below)?
- The correct way to call posts with ajax
- Converting multiple loops into one single loop with pagination
- How would I get 1 latest post from a query for 5 posts?
- How to store an extra (surrogate) ID when creating a post with wp_insert_post?
- Alternating post layout
- Check to see if specific loop has less than certain amount of posts
- How do I find which articles are missing a featured image in The WordPress database?
- Split WP_POST table based on post types
- Show all posts in sidebar in single.php
- Split WordPress Latest Posts in Multiple Columns and Rows with one single loop [closed]
- Avoid duplicate post from same Taxonomy
- Alternate row and columns every X posts
- Adding specific post category between posts in loop
- Best way to assign post position in a news site homepage? (no categories, no sticky posts)
- How do I restart my loop with get_next_post()?
- How to modify post content?
- Multiple loops are not reset
- Exclude category from
- How to exclude latest x posts from a paginated query?
- Posts will not display on page-mypage.php
- Pausing and Resuming WP_Query results
- Transferring WordPress Database – Serialised data
- Emojis replaced by ‘?’ automatically
- How to : pagination in 3 different custom loops on the same page
- Sharing post from archive page (loop) doesn’t work
- wp_posts table: safely remove unused columns to save database storage
- Multiple Loops Breaking Pages
- Change all author links in Blog roll
- Showing categories and subcategories with posts
- older blog posts not showing in new theme
- How to only publish posts with image in it
- WordPress Query Posts From Category Post on Static Page
- Loop through posts? Want to remove extra newlines in actual post HTML/content on backend
- Display post number by category
- WP_Query: Show 10 posts in date order, first three random
- How include css class based on post ( in loop ) slug?
- WordPress Loop: How to display recent posts in multiple divs
- Cannot implement byline into posts container in single.php
- Optimizing the blog loop
- How to check if there are posts with the same tag
- How to select particular month post from table and update the post status using MySQL?
- Accessing Post ID Within Loop
- Different number of posts per row in grid layout
- WP_Query of Category Not Showing First Post
- Update field in database for users
- How come this loop is not working? [closed]
- Using the loop to set locations for all posts on a single google map
- Defining ‘last’ class on foreach blog posts
- How to add content above footer in posts from specific category
- Is it possible to modify posts table to only read for more recent ones?
- Want to change the post every three days with in specific category
- Separate top level categories on archive-product.php by meta
- While loop in functions.php outputting the_title() of each post on frontpage
- Shortcode for Comments and Comment Boxes in Post Loop
- Permalink Short code showing unnecessary link text inside the loop
- How to setup default value of post_id
- Reusing old post IDs
- Trigger on DB make problem on wordpress?
- Comments are in database, don’t show up in WordPress backend or frontend
- Is there a way to save different data when USER interacts with the same POST?
- How can I get the last post while on the first post for pagination? As if it were infinite
- Very weird behaviour after removing WP pages
- Double loop output
- Clean up customize_changeset in DB
- post->ID displays the same ID number for every post
- Posts are not showing up on next page.
- Post are not showing up
- How to make post button to a random post
- I moved my site to another server, wp admin works so does the front page, but posts don’t work
- Advanced Post Display/Pagination/Ordering
- Keep post format class with isotope filter
- Can’t seem to replicate permalink structure for localhost development site
- When I click edit on a post, all the content disappear. Does anyone know how to fix this?
- Make assigning post to a specific category equivalent to assigning it to all categories
- How to inject a post within a loop
- Sort by category and then date?
- Loop not allowing infinite scroll after post per page limit
- Customise the appearance of 4 specific post ID’s within the loop?
- what template-part to call, to have my post in the center of the page?
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- Is there a maximum amount of pages for a multi-page post?
- posts_per_page – Repeats only first posts ‘post__in’ array
- blog post displaying within older post – loop issue?
- How to make category for word post_content
- How can I merge a several related posts into one post?