[Reddes] [WordPress Plugin][432518] multi-language-framework/trunk: [fix] parse query for child pages
Vinicius Andrade
vinicius.andrade at bireme.org
Mon Oct 3 18:50:46 BRST 2011
Victor y amigos de reddes,
Hemos identificado y corrigido un problema en el plugin de multi-language
que no permitia el display de las páginas secundarias.
Es importante actualizar el plugin para poder trabajar con las paginas
secundarias generadas en el plugin de BVS-Site.
Abrazos,
Vinicius de Andrade
*BIREME/OPAS/OMS*
---------- Forwarded message ----------
From: <noreply at wordpress.org>
Date: Fri, Sep 2, 2011 at 4:44 PM
Subject: [WordPress Plugin][432518] multi-language-framework/trunk: [fix]
parse query for child pages
To: vinicius.andrade at bireme.org
**
Log Message
[fix] parse query for child pages
[fix] page translation supports page attributes
Modified Paths
- multi-language-framework/trunk/parse_query.php<#1322bab9705df703_multilanguageframeworktrunkparse_queryphp>
- multi-language-framework/trunk/post_types.php<#1322bab9705df703_multilanguageframeworktrunkpost_typesphp>
Diff
Modified: multi-language-framework/trunk/parse_query.php (432517 => 432518)
--- multi-language-framework/trunk/parse_query.php 2011-09-02 19:41:05
UTC (rev 432517)
+++ multi-language-framework/trunk/parse_query.php 2011-09-02 19:44:16
UTC (rev 432518)@@ -37,15 +37,19 @@ // because we changed the
REQUEST_URI so it doesnt know if
($wp_query->query_vars['pagename']) { + //lets
check if there are slashes in the page name, that means a child
+ $pagename = $wp_query->query_vars['pagename'];
+ $pagename = str_replace( dirname($pagename) . '/', '', $pagename);
+ global $wpdb; -
$post_type = $wpdb->get_var( $wpdb->prepare("SELECT post_type FROM
$wpdb->posts WHERE post_name = %s", $wp_query->query_vars['pagename'])
);+ $post_type = $wpdb->get_var( $wpdb->prepare("SELECT
post_type FROM $wpdb->posts WHERE post_name = %s", $pagename) );
$wp_query->query_vars['post_type'] = $post_type;
//$wp_query->query_vars['post_type'] = $post_type . '_t_' .
$mlf_config['current_language'];-
$wp_query->query_vars['name'] = $wp_query->query_vars['pagename'];+
$wp_query->query_vars['name'] = $pagename;
$wp_query->query_vars[$wp_query->query_vars['post_type']] =
$wp_query->query_vars['name'];-
$wp_query->query_vars['pagename'] = '';+ $pagename = '';
$wp_query->is_page = false; $wp_query->is_single
= true; @@ -54,7 +58,7 @@ 'post_type' =>
$post_type, //'post_type' => $post_type . '_t_' .
$mlf_config['current_language'],- 'name' =>
$wp_query->query_vars['pagename'],+ 'name' =>
$pagename, $wp_query->query_vars['post_type'] =>
$wp_query->query_vars['name'] );
Modified: multi-language-framework/trunk/post_types.php (432517 => 432518)
--- multi-language-framework/trunk/post_types.php 2011-09-02 19:41:05
UTC (rev 432517)
+++ multi-language-framework/trunk/post_types.php 2011-09-02 19:44:16
UTC (rev 432518)@@ -28,12 +28,15 @@ case
'post': $menu_pos = 5;+
$p_type_supports =
array('title','editor','author','thumbnail','excerpt','comments');
break; case 'page':
$menu_pos = 20;+ $p_type_supports =
array('title','editor','author','thumbnail','excerpt','comments',
'page-attributes'); break;
default: $menu_pos =
$wp_post_types[$p_type]->menu_position ?
$wp_post_types[$p_type]->menu_position : 25;+
$p_type_supports =
array('title','editor','author','thumbnail','excerpt','comments');
} @@ -44,7 +47,7 @@
'capability_type' => $wp_post_types[$p_type]->capability_type,
'hierarchical' => $wp_post_types[$p_type]->hierarchical == 1,
'menu_position' => $menu_pos,-
'supports' => array('title','editor','author','thumbnail','excerpt','comments')+
'supports' => $p_type_supports );
//TODO: Post types names can only have 20 chars. Ho to
deal with it?@@ -163,9 +166,7 @@ if ($_GET['action'] != 'edit') {
$translation_of = $_GET['translation_of']; } else {-
$translation_of = get_post_meta($post->ID, '_translation_of');
- if (is_array($translation_of))
- $translation_of = $translation_of[0];+
$translation_of = get_post_meta($post->ID, '_translation_of', true);
} @@ -241,9 +242,9 @@ mlf_add_post_meta($new,
'_translation_of', $original); #var_dump($original, $new);
die;- + $also_translation_of = get_post_meta($original,
'_translation_of');- + if (is_array($also_translation_of)) {
foreach ($also_translation_of as $a) { if ($a !=
$new) {@@ -267,11 +268,8 @@ if ( defined('DOING_AUTOSAVE') &&
DOING_AUTOSAVE ) return $post_id; - if ( 'post' ==
$_POST['post_type'] ) {
- if ( !current_user_can( 'edit_post', $post_id ) )
- return $post_id;
- } + #var_dump($_POST['_translation_of']); die;
mlf_add_translation_relationship($_POST['_translation_of'], $post_id);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.bireme.br/pipermail/reddes/attachments/20111003/4a9d69bb/attachment.html
More information about the Reddes
mailing list