WordPress.org

Forums

List Category Posts + qTranslate (2 posts)

  1. mmx0
    Member
    Posted 2 years ago #

    Make List Category Posts 0.24 play nice with qTranslate - September 2012

    // Custom Function UPDATE 2012-Sept-15 CatListDisplayer.php
    		private function get_post_title($single, $tag = null, $css_class = null){
    			if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
            			$title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($single->post_title);
    				$info = '<a href="' . get_permalink($single->ID) .
    					'" title="'. $title . '">' .
    					$title . '</a>';
    			} else {
    // This is the original code in get_post_title (plus the return statement)
    				$info = '<a href="' . get_permalink($single->ID) .
    					'" title="'. $single->post_title . '">' .
    					$single->post_title . '</a>';
    			}
    				return $this->assign_style($info, $tag, $css_class);
    		}

    The solutions posted here:
    http://wordpress.org/support/topic/plugin-list-category-posts-qtranslate-issue?replies=6

    were a bit outdated for version 0.24 of List Category Posts

  2. presdec
    Member
    Posted 2 years ago #

    Completely different plugin, but do u think you could help out with this?:

    $ret = '';
    		if (is_array($posts)) {
    			$ret .= '<ul class="wdpv_popular_posts ' . ($network ? 'wdpv_network_popular' : '') . '">';
    			foreach ($posts as $post) {
    				if ($network) {
    					$data = get_blog_post($post['blog_id'], $post['post_id']);
    					if (!$data) continue;
    				}
    				$title = $network ? $data->post_title : $post['post_title'];
    				$permalink = $network ? get_blog_permalink($post['blog_id'], $post['post_id']) : get_permalink($post['ID']);
    
    				$ret .= "<li>" .
    					"<a href='{$permalink}'>{$title}</a> " .
    					sprintf(__('<span class="wdpv_vote_count">(%s votes)</span>', 'wdpv'), $post['total']) .
    				"</li>";
    			}
    			$ret .= '</ul>';
    		}

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.