Skip to content

Instantly share code, notes, and snippets.

@Spoygg
Created July 14, 2012 15:26
Show Gist options
  • Save Spoygg/3111827 to your computer and use it in GitHub Desktop.
Save Spoygg/3111827 to your computer and use it in GitHub Desktop.
Merge publication prevods to single page prevod
<?php
// First fetch all prevods
// Mysql call
$sql = "
SELECT ID, post_title, post_content, post_parent, post_name
FROM wp_rscom_posts
WHERE post_parent
IN (
SELECT ID
FROM wp_rscom_posts
WHERE post_parent
IN (
SELECT ID
FROM `wp_rscom_posts`
WHERE post_parent = 0
AND post_type = 'prevod'
AND post_status = 'publish'
)
AND post_type = 'prevod'
AND post_status = 'publish'
AND post_title NOT LIKE '%blog%'
)
AND post_type = 'prevod'
AND post_status = 'publish'
order by post_parent, ID"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment