Tag Info

Hot answers tagged

7

The requirements you are describing require much more of an explanation than is really suitable here. A simple solution might be to mark the duplicate posts as duplicates via a meta box on the post screen. This meta box would have one input: A reference to another post. Check out this tutorial on how to build a custom meta box. Suppose you've set up a meta ...


6

A single query Thought about this a bit more and there's a chance that you can go with a single/the main query. Or in other words: No need for two additional queries when you can work with the default one. And in case you can't work with a default one, you won't need more than a single query no matter for how many loops you want to split the query. ...


4

While this is not the best way to solve this problem (@kaiser's answer is), to answer the question directly, the actual query results will be in $loop->posts and $loop2->posts, so ... $mergedloops = array_merge($loop->posts, $loop2->posts); ... should work, but you'd need to use a foreach loop and not the WP_Query based standard loop structure ...


3

Actually there's meta_query (or WP_Meta_Query) - which takes an array of arrays - where you can search for the _thumbnail_id rows. If you then check for EXISTS, you're able to obtain only those which have this field. Combining this with the cat argument, you'll only get posts that are assigned to the category with the ID of 1 and that have a thumbnail ...


3

You can try the following (untested): Setup the query arguments #1: (today) //----------------- // Query part #1: //----------------- $args1 = array( 'post_type' => 'post', 'orderby' => 'comment_count', 'ignore_sticky_posts' => 1, 'date_query' => array( array( ...


2

When you choose to import them into the new/merged website, you'll have the option to import the author, or to assign a new one to the imported posts. You could assign different authors to each import and use that to separate the content. Do both use the same categories? If they don't it should be simple since they will retain the categories when imported. ...


2

The only good solution I've seen for this is Crowd Favorite's RAMP plugin. It can manage content deployment and DB merging to/from a staging site. http://crowdfavorite.com/ramp/


2

NOTE: XML Importer will not work for this task as the amount of data is too large. This tool is by far the simplest solution if there's any way you can get it to work. Is it absolutely "too large" for the importer, or just limited by file upload / PHP execution time limits? If I were doing this, I'd crank up the limits on my development environment to ...


1

/** * Merge metadata from one post to another. * * @param int $from_ID Source post ID * @param int $to_ID Target post ID * @param bool $overwrite Whether to overwrite metadata if the key already exists * @return bool|array */ function wpse_20231_merge_postmeta( $from_ID, $to_ID, $overwrite = true ) { // get ALL metadata for $from_ID if ( ...


1

A lot depends on the setup of the two current multisites: Do they share a common user base, if any? What kind of plugins are installed, if any? Likewise themes? Is it obvious which one is going to be imported in to the other? How many different authors are there? Things like author IDs will possibly have to be synchronised? What about user comments? The ...


1

Easiest way would be to just export the one WordPress site, and then import it into the new site. Don't try to get too complicated with this.


1

What you need is actually a third query to get all the posts at once. Then you change your first two queries to not return the posts, but only the post IDs in a format that you can work with. The 'fields'=>'ids' parameter will make a query actually return an array of matching post ID numbers. But we don't want the whole query object, so we use get_posts ...



Only top voted, non community-wiki answers of a minimum length are eligible