Created
August 1, 2011 15:58
-
-
Save marcboivin/1118413 to your computer and use it in GitHub Desktop.
Hacky way to make get_post_by_title work with qTranslate
This file contains hidden or 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
<? | |
function qtrans_get_page_by_title($page_title, $output = OBJECT, $post_type = 'page' ){ | |
global $wpdb; | |
// We append a < at the end of the like caus it's the ending charater | |
$page = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_title LIKE '%". $page_title ."<%' AND post_type= '".$post_type."'" ); | |
if ( $page ) | |
return get_page($page, $output); | |
return null; | |
} | |
//Consider using qtrans_get_page_by_title(__('Page name', 'textmodain'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment