MichDe / wordpress-geo-mashup

Automatically exported from code.google.com/p/wordpress-geo-mashup
1 stars 0 forks source link

Problem with WPML #435

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Wordpress 3.0.2
Geomashup 1.3.9

Hi, I've done one multilanguge site, I'm using WPML 1.8.3 to these, and I've 
done one template for a page where I want to show the posts of one category. In 
Spanish that is the default language, all goes fine, but in Catalan, the second 
language, the map shows the marks, but it isn't loading any information.
On template page I've put the call to the map of geomashup, the code is:

$cate = get_category(72);//Display the posts with this category
$cate = icl_object_id($cate->term_id, 'category', false, ICL_LANGUAGE_CODE); 
//returns the category's id in the correct language

$cat = 
'map_content=global&map_cat='.$cate.'&zoom='.((isset($_GET["zoom"]))?$_GET["zoom
"]:8 .'&center_lat=39.60675&center_lng=2.98142');
echo GeoMashup::map($cat);

The URL: 
   - Spanish: http://www.ibavi.com/listados/
   - Catalan: http://www.ibavi.com/ca/llistats/

Thanks

Original issue reported on code.google.com by brujulab...@gmail.com on 3 Mar 2011 at 11:37

GoogleCodeExporter commented 9 years ago
I don't know enough about the inner workings of WPML to know why this is, but 
the query for the post in Catalan is failing. So an example looks like post 
1633 is spanish, and 1637 is the translation. This query seems to work:

query_posts( array( 
  'post__in' => array( 1633 ), 
  'post_type' => 'any', 
  'post_status' => 'publish,future', 
  'suppress_filters' => true,
  'caller_get_posts' => true,
  'posts_per_page' => -1
) );

But if you do the same query for 1637, no result. Can you verify that, or see 
why it would be the case?

Original comment by dylankk...@gmail.com on 4 Mar 2011 at 6:27

GoogleCodeExporter commented 9 years ago
I don't understand this.
If i try with the spanish id:
GeoMashup::map(map_content=global&map_cat=72&zoom='.((isset($_GET["zoom"]))?$_GE
T["zoom"]:8 .'¢er_lat=39.60675¢er_lng=2.98142'));
I get results, but if I try with the catalan:
GeoMashup::map(map_content=global&map_cat=72&zoom='.((isset($_GET["zoom"]))?$_GE
T["zoom"]:8 .'¢er_lat=39.60675¢er_lng=2.98142'));
It gets only the points but there aren't info on the bubble.

But if I try:
<ul>
<?php
global $post;
$args = array( 'numberposts' => 15, 'offset'=> 1, 'category' => 72 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :  setup_postdata($post); ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
I display all titles in the correct language and the permalink it's OK too.

Original comment by brujulab...@gmail.com on 7 Mar 2011 at 3:13

GoogleCodeExporter commented 9 years ago
I don't think that answers my question. Have you looked at issue 366? Maybe you 
could ask another WPML user via that issue.

Original comment by dylankk...@gmail.com on 16 Mar 2011 at 1:16

GoogleCodeExporter commented 9 years ago
Ok, thank you I look at this

Original comment by brujulab...@gmail.com on 31 Mar 2011 at 8:36

GoogleCodeExporter commented 9 years ago
I think we have a workaround here, and a clue to the cause of the problem: 

http://motionmill.com/3287/wpml-and-geo-mashup/

Original comment by dylankk...@gmail.com on 19 May 2011 at 2:45

GoogleCodeExporter commented 9 years ago
Here is a modified version of the mentioned workaround that works with custom 
post types:

<?php

$object_ids = $_GET['object_ids'];

if ( !is_array( $object_ids ) )
    $object_ids = split( ‘,’, $object_ids );

// extract the post type
$post_type = get_post_type($translation_ids[0]);

// Create a new instance
$query_vars = array( 'post__in' => $translation_ids,
                                 'post_type' => $post_type,
                                 'post_status' => 'publish' );
$second_query = new WP_Query( $query_vars );

// The Loop
...

?>

Original comment by mamoun.d...@gmail.com on 24 Jun 2011 at 3:19

GoogleCodeExporter commented 9 years ago
Thanks Ma'moun. Looks like that would not work if there were posts of different 
types at the same location, but hopefully that's a rare case. You'd have to 
make an array of post types to cover that possibility. 

Original comment by dylankk...@gmail.com on 27 Jun 2011 at 11:36

GoogleCodeExporter commented 9 years ago
Opps, while reading your reply I noticed that there was a typo in my code, 
since I actually used different variable names in my file. $translation_ids 
above should be: $object_ids (so $translation_ids[0] also will be 
$object_ids[0])

Original comment by mamoun.d...@gmail.com on 28 Jun 2011 at 9:02