-
Mountain_KingParticipant
Hi Daniel,
thumbs up for your wonderful Cover WP theme which is simply ideal for our multilingual online school magazine http://www.camaeleon.org that I’m about so start!
There is just one problem I encountered using your theme with the qTranslate plugin for multilingual wordpress sites: The content of the different language versions is displayed in one article in the “Popular” category, rather than in English for the English version of the website, German for the German version of the website etc.
Everything works fine in all other categories, e.g., “featured”, “latest”, “headline” and so on. Can you think of where the problem lies?Mountain_KingParticipantI just noticed that the problem only occurs when I choose the “most viewed” option rather than “most commented”. Does this information help to find a solution to this riddle? π
Mountain_KingParticipantHi everyone,
I found the solution myself. You need to change the code concerning “popular posts” in the functions.php file of the theme.
Here is the modified code:
[code]// Popular Posts Sectionfunction display_popular() {
global $wpdb;
$words = 17;
$backup = $words;
$order = get_option(‘cover_wp_popular’);
if ($order == ‘views’) :
$metakey = “AND meta_key = ‘_views'”;
$orderby = “$wpdb->postmeta.meta_value+0”;
else:
$orderby = “comment_count”;
endif;
$result = $wpdb->get_results(“SELECT $wpdb->posts.* FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID WHERE post_type=’post’ AND post_status=’publish’ $metakey ORDER BY $orderby DESC, 5”);
$hdl = 1;
$ppl = 0;
foreach ($result as $topfive) {
$postid = $topfive->ID;
$title = $topfive->post_title;
$content = $topfive->post_content;
$content = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($content);
$content = strip_tags($content);
$commentcount = $topfive->comment_count;
$excerpt = explode(‘ ‘,$content);
if($ppl < 3) { ?>
<div class=”spost”>
<h2>” title=”<?php _e(‘Permanent Link to’,’cover-wp’) ?> <?php _e($title); ?>”><?php _e($title); ?></h2>
<?phpif ( function_exists( ‘has_post_thumbnail’ ) && has_post_thumbnail($postid) )
{
echo get_the_post_thumbnail($postid, array(95,80), array(‘alt’ => $title));
}
else $words = $words + 15;
if(count($excerpt) > $words) $count = $words;
else $count = count($excerpt); ?>
<p><?php for($i = 0; $i <= $count – 1; $i++) { echo $excerpt[$i]; echo ‘ ‘; } echo ‘…’; ?> “><?php _e(‘Read more’,’cover-wp’) ?> »</p>
</div><!– /spost –>
<div class=”spbottom”></div> <?php }
$words = $backup;
$ppl++;
}
}[/code]I hope this helps people with the same problem.
You must be logged in to reply to this topic.