Help! PHP troubles on Wordpress

Hello !

Okay this is a problem for the pros. I’ll try to explain this as clearly as I can.

I’m using a Wordpress template called Boldy (which looks like this: http://wordpress.site5.net/boldy/)
The big window is called the “Slider” and the three bottom smaller windows and posts, the “homeboxes”.

Boldy has options allowing you to define which Wordpress page content will appear in the Slider (images only), and which content will appear in the Homeboxes (image and text).

I’m using WPML, a plugin that allows the translation of a Wordpress webpage between two languages, in my case, French and English.

Now.

Normally you can setup Boldy settings so that you define which Wordpress Pages are called to fill the Slider and Homeboxes with content. But since there are only options for one language, I needed a way to call in the contents of another language, when the users switches languages.

Right now, my home.php is setup so that the content in the Homeboxes and Slider (whom feature graphic text) will appear in english or french when the proper language is activated. Problem is, it doesn’t work.

It seems that right now, the content shown in Slider and Homeboxes is rather that of a random post, instead of the proper Wordpress pages. Altough everything appears to be setup correctly.

THE PHP:

I have two documents: (Home.php) and (mojob.inc.php).

Home.php has hacks into it that add a (GetID) argument to the normal code. Since French and english have different IDs, doing this allows to grab the ID which corresponds to the active language.

mojob.inc.php holds all the functions necessary for the hacks in home.php to work.

Now here’s the question: Everything shows up properly when you remove the GetID argument, but the home page doesn’t get translated. It seems that when GetID is active, it’s not actually getting the pages ID, but some other random ID instead.

Help. Here are the two docs:

HOME.PHP

<?php get_header(); ?>
<?php if(get_option('boldy_slider')!=''){ //$page_data = get_page(get_option('boldy_slider')); /**/$page_data = get_page(getID(get_option('boldy_slider')));/**/ $content = $page_data->post_content; echo $page_data->post_content; }else{?>
This is the slider. In order to have items here you need to create a page in which to insert the images, simply one after another, setting up the link to point at ( if needed ) and text captions in the Title field. Then select the page as the "slider page" in the Theme Options Page. Make sure your images are 960px x 370px.
<?php }?>
<?php if(get_option('boldy_blurb_enable')=="yes" && get_option('boldy_blurb_text')!=""){ ?>

<a href="<?php if(get_option('boldy_blurb_page')!=""){ //echo get_permalink(get_option('boldy_blurb_page')); /**/echo get_permalink(getID(get_option('boldy_blurb_page')));/**/ }elseif(get_option('boldy_blurb_link')!=""){ echo get_option('boldy_blurb_link'); } ?>"> <?php echo ACTIVE_LANG == 'fr'? get_option('boldy_blurb_text') : 'Get represented by Mojob and stand out from the crowd by joining our talent network today !'; ?>

<?php }?> <?php //$box1=get_post(get_option('boldy_home_box1')); /**/$box1=get_post(getID(get_option('boldy_home_box1')));/**/ //$box2=get_post(get_option('boldy_home_box2')); /**/$box2=get_post(getID(get_option('boldy_home_box2')));/**/ //$box3=get_post(get_option('boldy_home_box3')); /**/$box3=get_post(getID(get_option('boldy_home_box3')));/**/ if(get_option('boldy_home_box1')!= null && get_option('boldy_home_box2')!= null && get_option('boldy_home_box3')!= null){?>

<?php echo $box1->post_title?>

<?php echo apply_filters('the_content', $box1->post_content);?> <?php _e('Suite');?>»

<?php echo $box2->post_title?>

<?php echo apply_filters('the_content', $box2->post_content);?> <?php _e('Suite');?>»

<?php echo $box3->post_title?>

<?php echo apply_filters('the_content', $box3->post_content);?> <?php _e('Suite');?>»
<?php }?>

MOJOB.INC.PHP

<?php $languages = function_exists('icl_get_languages')? icl_get_languages('skip_missing=1') : array('fr'); $lang = getActiveLanguage('language_code'); define('ACTIVE_LANG', $lang); function getActiveLanguage($key='ID') { global $languages; foreach ($languages as $lang) { if ($lang['active']) return $lang[$key]; } } function getLanguages() { global $languages; $langs=''; foreach ($languages as $lang) { if (!$lang['active']) $langs .= ''.$lang['translated_name'].''; } return $langs; } function getId($item, $type='page') { if (function_exists('icl_object_id')) return; if (!is_numeric($item)) $item=get_option($item); return icl_object_id($item, $type, true); } function is_registration($p) { if (is_object($p)) $p = $p->ID; return ($p == '2374' || $p == '2383')? true : false; } function is_slider($p) { if (!is_object($p)) $p = get_post($p); return (false !== (strpos($post->post_content, '[wpcodaslider')))? true : false; } /* add_action('show_user_profile', 'mojob_profile'); add_action('edit_user_profile', 'mojob_profile'); function mojob_profile($user) { global $lang; $roles = array_keys($user->data->wp_capabilities); if (in_array('talent', $roles)) $file = sprintf('talents-%s.php', $lang); elseif (in_array('employer', $roles)) $file = sprintf('inc-%s.php', $lang); if ($file) include dirname(__FILE__).'/forms/'.$file; } add_action('personal_options_update', 'save_extra_user_profile_fields'); add_action('edit_user_profile_update', 'save_extra_user_profile_fields'); function save_extra_user_profile_fields($uid) { if (current_user_can('edit_user', $uid)) { foreach ($_POST as $key=>$value) { update_usermeta($uid, $key, $value); } } } */
Sponsor our Newsletter | Privacy Policy | Terms of Service