WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WordPress on external Website with use of qtranslate (2 posts)

  1. chschu
    Member
    Posted 1 year ago #

    Hello together!

    I'm using WordPress for quite a while and am very happy with it's usage. But now I've got a problem with running WordPress on an external Website. Here is my problem:

    I use WordPress for my Blog in 3 languages (german, english and chinese) with the qTranslate plugin. In addition I run a autonomous Website without WordPress, simply by HTML. What I want to do now is showing the 3 last Posts from my Blog on the website's welcome page.
    This is the code I use for showing the Posts (I found in this board, thanks for that, it is fantastic!)

    <?php
    	#
    	# Die Vollansicht des Blogeintrages
    	#
    	$c = 0;
    
        $args = array( 'numberposts' => 3, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date");
        $postslist = get_posts( $args );
    
        foreach ($postslist as $post) : setup_postdata($post);
    	$c++;
    	if ($c == 1) { $class = 'style="top:0px;"'; }else{$class = '';}
    	?>
               <div class="cn_content" <?php echo $class; ?>>
              <div class="cn_image"><img src="<?php echo catch_that_image(); ?>" title="<?php the_title(); ?>" height="172px" /></div>
               <div class="cn_articleContent">
               <h1><?php the_title(); ?></h1>
    
               <?php $strings = preg_split('/(\.|!|\?)\s/', strip_tags($post->post_content), 2, PREG_SPLIT_DELIM_CAPTURE);
    			echo apply_filters('the_content', $strings[0] .  $strings[1]); ?>
    
                <p class="cn_date">vom <?php the_date('d. M. Y'); ?></p>
                </div>
    
                <div class="cn_button"><a class="orangeButton" href="<?php the_permalink(); ?>">Zum Artikel</a></div>
    
                </div>
    
    <?php endforeach; ?>

    The website itself is also in 3 languages via different pages ( e.g. pageDE.php, pageEN.php, pageCN.php ). What I want to do now is using 3 inquiries for each language. How can I tell WordPress or qTranslate, that I just want to have posts e.g. in german with the code shown above?!

    Thanks for your help!
    Regards from Germany

  2. chschu
    Member
    Posted 1 year ago #

    Okay, I just found the solution myself. Here is where I found the hint for my problem http://wordpress.stackexchange.com/questions/51946/qtranslate-get-content-by-language
    It is very important to give the id a value so that WordPress is able to find out your related page. You can now change between the languages via 'de', 'en', 'cn' ...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.