hello,
I have a slight bug with my home-template.php file, it’s not propagating correctly “news” in French version but works fine for Dutch version. I looked at the code but didnt find anything weird, maybe someone could spot the error? I’ll be very appreciated!
Here is the home page: http://olivia.be/?lang=fr
so, under the slider, the right section propagates 5 first lines from “News” page. It works fine in Dutch but weirdly not in French.
Here is the code from .php file:
Template Name: Homepage
*/
get_header();
?>
<div class="container clearfix">
<div class="homepage-content">
<?php
// start content output
// if ( have_posts()) : while ( have_posts()) : the_post();
// the_content();
// endwhile; endif;
// end content output
// JHL TODO:edit
?>
<div class="ten columns">
<?php // fr_FR nl_NL ?>
<?php
if (get_locale() == 'fr_FR'){
$page = get_page_by_title( "Top Nouvelles" );
echo apply_filters( 'the_content', $page->post_content );
}else if (get_locale()){
$page = get_page_by_title( "Top News" );
echo apply_filters( 'the_content', $page->post_content );
}
?>
</div>
<div class="five columns">
<?php
// get latest post
$args = array(
'post_type' => 'post',
'category__not_in' => '16',
'posts_per_page' => 5,
'post_status' => array('future', 'publish'),
'orderby' => 'post_date',
'order' => 'DESC',
);
$dd_query = new WP_Query( $args );
if ( $dd_query->have_posts() ) :
while ( $dd_query->have_posts() ) : $dd_query->the_post();?>
<div class="post-list-element">
<a href="<?php echo the_permalink();?>">
<div class="left"><?php echo the_title();?></div>
<!-- <div class="right"><span class="icon-calendar"></span><?php //echo the_date();?></div> -->
</a>
<!-- <div class="info"><?php echo the_excerpt();?></div> -->
</div>
<?php
endwhile;
endif;
// get latest donateurs post
/*$args = array(
'post_type' => 'post',
'category__in' => '16',
'posts_per_page' => 1,
'post_status' => array('future', 'publish'),
'orderby' => 'post_date',
'order' => 'DESC',
);
$dd_query = new WP_Query( $args );
if ( $dd_query->have_posts() ) :
while ( $dd_query->have_posts() ) : $dd_query->the_post();?>*/
/*<div class="post-list-element">
<a href="<?php echo the_permalink();?>">
<div class="left"><?php echo the_title();?></div>
<div class="right"><span class="icon-calendar"></span><?php echo the_date();?></div>
</a>
<div class="info"><?php echo the_excerpt();?></div>
</div>
<?php*/
/*endwhile;
endif;*/
?>
</div>
</div>
</div>
<?php
global $dd_sn;
$home_sections = ot_get_option( $dd_sn . 'home_sections', false );
if ( $home_sections ) {
$parity = 'even';
foreach ( $home_sections as $home_section ) {
if ( $parity == 'odd' ) {
$parity = 'even';
} else {
$parity = 'odd';
}
if ( ! isset( $home_section[ $dd_sn . 'module_blog_cat' ] ) ) {
$home_section[ $dd_sn . 'module_blog_cat' ] = 'all';
}
if ( ! isset( $home_section[ $dd_sn . 'module_causes_cat' ] ) ) {
$home_section[ $dd_sn . 'module_causes_cat' ] = 'all';
}
if ( ! isset( $home_section[ $dd_sn . 'module_post_width' ] ) ) {
$home_section[ $dd_sn . 'module_post_width' ] = 'one_fourth';
}
if ( 'tabs' == $home_section[ $dd_sn . 'module' ] ) {
dd_home_section_tabs( array( 'parity' => $parity, 'title' => $home_section['title'] ) );
} elseif ( 'causes' == $home_section[ $dd_sn . 'module' ] ) {
dd_home_section_causes( array( 'parity' => $parity, 'title' => $home_section['title'], 'amount' => $home_section[ $dd_sn . 'module_amount_posts'], 'category' => $home_section[ $dd_sn . 'module_causes_cat' ], 'post_width' => $home_section[ $dd_sn . 'module_post_width' ] ) );
} elseif ( 'news' == $home_section[ $dd_sn . 'module' ] ) {
dd_home_section_blog( array( 'parity' => $parity, 'title' => $home_section['title'], 'amount' => $home_section[ $dd_sn . 'module_amount_posts'], 'category' => $home_section[ $dd_sn . 'module_blog_cat' ], 'post_width' => $home_section[ $dd_sn . 'module_post_width' ] ) );
} elseif ( 'events' == $home_section[ $dd_sn . 'module' ] ) {
dd_home_section_events( array( 'parity' => $parity, 'title' => $home_section['title'], 'amount' => $home_section[ $dd_sn . 'module_amount_posts'] ) );
} elseif ( 'products' == $home_section[ $dd_sn . 'module' ] ) {
dd_home_section_products( array( 'parity' => $parity, 'title' => $home_section['title'], 'amount' => $home_section[ $dd_sn . 'module_amount_posts'] ) );
} elseif ( 'staff' == $home_section[ $dd_sn . 'module' ] ) {
dd_home_section_staff( array( 'parity' => $parity, 'title' => $home_section['title'], 'amount' => $home_section[ $dd_sn . 'module_amount_posts'] ) );
} elseif ( 'text' == $home_section[ $dd_sn . 'module' ] ) {
dd_home_section_text( array( 'parity' => $parity, 'title' => $home_section['title'], 'content' => $home_section[ $dd_sn . 'module_text_content'] ) );
} elseif ( 'sponsors' == $home_section[ $dd_sn . 'module' ] ) {
dd_home_section_sponsors( array( 'parity' => $parity, 'title' => $home_section['title'], 'amount' => $home_section[ $dd_sn . 'module_amount_posts'], 'post_width' => $home_section[ $dd_sn . 'module_post_width' ] ) );
} elseif ( 'events_no_cal' == $home_section[ $dd_sn . 'module' ] ) {
dd_home_section_events_no_cal( array( 'parity' => $parity, 'title' => $home_section['title'], 'amount' => $home_section[ $dd_sn . 'module_amount_posts'], 'category' => $home_section[ $dd_sn . 'module_causes_cat' ], 'post_width' => $home_section[ $dd_sn . 'module_post_width' ] ) );
}
}
} else {
/* Default */
// Disable footer slider
// dd_home_section_tabs( array( 'parity' => 'odd', 'title' => '' ) );
// dd_home_section_causes( array( 'parity' => 'even', 'title' => 'OUR CAUSES' ) );
// dd_home_section_blog( array( 'parity' => 'odd', 'title' => 'BLOG' ) );
// dd_home_section_events( array( 'parity' => 'even', 'title' => 'EVENTS' ) );
// dd_home_section_products( array( 'parity' => 'odd', 'title' => 'PRODUCTS' ) );
}
get_footer();
?>