Ondersteuning » Vertaling WordPress (NL) » WPML voor homepage met nieuwsberichten

  • DimitriDVV

    (@dimitridvv)


    Beste

    ik heb een homepage die gewoon html en css gebruikt, maar ook een php code om de nieuwsberichten in te laden.
    Hier loopt het fout natuurlijk.

    Dit is de code:

    <h1 class="background">Latest news</h1>
    
                <!--- MAIN LOOP -->
                <?php
                    $args = array(
                        'showposts' => 3,
                        'orderby' => 'date',
                        'post_type' => 'post'
                    );
                    $wp_query = new WP_Query( $args );
                ?>
                <!-- the loop -->
                <?php if ( have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
                    <div class="video">
                        <?php the_post_thumbnail(); ?>
                        <h2><?php the_title(); ?></h2>
                        <h3></h3>
                        <?php the_content('<p class="nieuwsButton">Read more... <i class="fa fa-arrow-circle-right white"></i></p>'); ?>
                    </div>
                <?php endwhile; endif; ?>
                <!-- end of the loop -->
                <!--- /MAIN LOOP -->
                <?php wp_reset_query(); ?>
    
                    <div style="clear: both;">&nbsp;</div>

    Die php code wordt natuurlijk niet gerenderd.
    Echter, wanneer ik een plugin als Insert PHP gebruik, dan werkt het ook niet en zie ik een witte pagina

    Ik gebruik dan – na het installeren van de plugin – volgende code:

    <h1 class="background">Latest news</h1>
    
                <!--- MAIN LOOP -->
                [insert_php]
                    $args = array(
                        'showposts' => 3,
                        'orderby' => 'date',
                        'post_type' => 'post'
                    );
                    $wp_query = new WP_Query( $args );
                [/insert_php]
                <!-- the loop -->
                [insert_php] if ( have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); [/insert_php]
                    <div class="video">
                        [insert_php] the_post_thumbnail(); [/insert_php]
                        <h2>[insert_php] the_title(); [/insert_php]</h2>
                        <h3></h3>
                        [insert_php] the_content('<p class="nieuwsButton">Read more... <i class="fa fa-arrow-circle-right white"></i></p>'); [/insert_php]
                    </div>
                [insert_php] endwhile; endif; [/insert_php]
                <!-- end of the loop -->
                <!--- /MAIN LOOP -->
                [insert_php] wp_reset_query(); [/insert_php]
    
                    <div style="clear: both;">&nbsp;</div>

    Normaal gezien gebruik ik front-page.php om dit probleem om te zeilen, maar nu heb ik een meertalige website dus gaat dit zo niet.

  • Het onderwerp ‘WPML voor homepage met nieuwsberichten’ is gesloten voor nieuwe reacties.