Skip to content

Instantly share code, notes, and snippets.

@davidgtonge
Created September 19, 2011 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davidgtonge/1227605 to your computer and use it in GitHub Desktop.
Save davidgtonge/1227605 to your computer and use it in GitHub Desktop.
home_page_ids
<?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