How to use get_page_by_title() with qTranslate?

Any idea how I can use the WP function get_page_by_title() with qTranslate installed?

for example:

Read More
$page_contact = get_page_by_title( '_e("[:en]contact");' ,'page' );
$page_contact_ID = $page_contact->ID; echo '~~~~'.$page_contact_ID;

The only way I can get a match is by including the whole string with all the languages – and there is no way that’s going to work once people start editing the pages…

Related posts

Leave a Reply

1 comment

  1. Ok, now that you know your final goal I can try to answer :

    first , A little background for other people who will read this and might wonder why this question exists (because it can help also in other cases )

    the function get_page_by_title() does exactly what the name say . But qTarnslate , as well as other plugins , actually CHANGE the title in the DB .

    The answer to such problems is using another less-known (but not less powerful) function called get_page_by_path();

    why does this help ? Because the Path of the page will not be changed .
    Usually it will be used like this :

    get_page_by_path('parent-page/sub-page');
    

    But a much more cool thing is that the “path” parameter can be the SLUG , which is NOT changed by qTranslate .

    so for the direct answer , please try this :

    $page = get_page_by_path('your-slug-of-page-to-exclude');
    wp_list_pages('exclude='.$page->ID.'&title_li=');
    

    that being said, and as a side note – there is no reason for you to lose the ID of pages when migration, if you simply export your DB and import to the new server , like described in the CODEX or HERE.