Created
September 19, 2011 21:01
-
-
Save davidgtonge/1227605 to your computer and use it in GitHub Desktop.
home_page_ids
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_wpml_home_ids(){ | |
//Globalizse the $wpdb variable (instantiation of the wpdb class) | |
global $wpdb; | |
//Get the front-page id from the options table | |
$home_id = get_option('page_on_front'); | |
//Run the query | |
$postids=$wpdb->get_col($wpdb->prepare(" | |
SELECT post_id.element_id | |
FROM `wp_icl_translations` AS trid | |
JOIN `wp_icl_translations` AS post_id | |
ON post_id.trid = trid.trid | |
WHERE trid.element_id = %d", $sc_home_id)); | |
//Return the array of post ids | |
return $postids; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment