Skip to content

Commit

Permalink
set proper language for new listing
Browse files Browse the repository at this point in the history
  • Loading branch information
meloniq committed Mar 6, 2013
1 parent 6137b28 commit 041e657
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions wpml-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ function app_wpml_appthemes_page_id_for_template( $page_id, $template ) {
add_filter( 'appthemes_page_id_for_template', 'app_wpml_appthemes_page_id_for_template', 10, 2 );


/**
* ClassiPress: hook into cp_add_new_listing(), set proper language for new listing
*/
function app_wpml_cp_add_new_listing( $post_id ) {
global $sitepress;

if ( $sitepress->get_current_language() == $sitepress->get_default_language() )
return;

$post_type = get_post_type( $post_id );
$sitepress->set_element_language_details( $post_id, 'post_' . $post_type, null, $sitepress->get_current_language() );
}
add_action( 'cp_action_add_new_listing', 'app_wpml_cp_add_new_listing' );

/**
* ClassiPress: hook into cp_get_ad_details()
*/
Expand Down

0 comments on commit 041e657

Please sign in to comment.