+8 votes
861 views
in Programming by (590 points)
i have a wordpress site , im new on it.. in the footer i have the slider in the combination of two post when i add the new post it's not showing in the next page . and not in proper order :

plz hepl me!
related to an answer for: how to link a custom page in WordPress!
closed

2 Answers

0 votes
by Expert (5.1k points)
selected by
 
Best answer

Try this !. i put the condition here!.. 

 

<div class="container">

    <h1>Latest News & Updates</h1>
    <div id="slides">
        <?php $the_query = new WP_Query($args); ?>
        <?php if ($the_query->have_posts()) : ?>
            <?php $counter = 1; ?> 
            <?php $obj = wp_count_posts(); ?>
            <?php $totalPosts = $obj->publish; ?>
            <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
                <?php $remainder = $counter % 2; ?>
                <?php if ($remainder == 1): ?>
                    <div class="slide">
 
                    <?php endif; ?>
                    <div class="<?php echo $remainder == 1 ? 'slide-left' : 'slide-right'; ?>">
                        <h2><?php the_time('j'); ?><?php the_time('M'); ?><span> <?php the_time('Y'); ?></span></h2>
                        <div class="img">
                            <?php
//                            if (has_post_thumbnail()) { // check if the post has a Post Thumbnail assigned to it.
//                                the_post_thumbnail();
//                            }
                            ?>
                        </div>
                        <div class="content" style="padding-left: 14px;">
                            <p class="bold"><?php echo get_the_title(); ?></p>
                            <?php
                            echo the_excerpt();
                            ?>
 
                            <?php $link = get_permalink(); ?>
 
                            <p class="more"><?php echo"<a href=$link>Readmore >></a>" ?></p>
                        </div>
                    </div>
 
                    <?php if ($remainder == 0 || $counter == $totalPosts): ?>
                    </div>
                <?php endif; ?>
                <?php $counter++; ?>
            <?php endwhile; ?>
        <?php endif; // have post         ?>
0
by (590 points)
nice its working! thanks amit_pammu
0 votes
by Expert (5.1k points)
i cant understand your problem explain it?
0
by (590 points)
<div class="container">
    <h1>Latest News & Updates</h1>
    <div id="slides">
        <?php $the_query = new WP_Query($args); ?>
        <?php if ($the_query->have_posts()) : ?>
          
            <?php $obj = wp_count_posts(); ?>
            <?php $totalPosts = $obj->publish; ?>
            <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
               
           
                    <div class="slide">

                    <?php endif; ?>
                    <div class="<?php echo $remainder == 1 ? 'slide-left' : 'slide-right'; ?>">
                        <h2><?php the_time('j'); ?><?php the_time('M'); ?><span> <?php the_time('Y'); ?></span></h2>
                        <div class="img">
                            <?php
//                            if (has_post_thumbnail()) { // check if the post has a Post Thumbnail assigned to it.
//                                the_post_thumbnail();
//                            }
                            ?>
                        </div>
                        <div class="content" style="padding-left: 14px;">
                            <p class="bold"><?php echo get_the_title(); ?></p>
                            <?php
                            echo the_excerpt();
                            ?>
this is my code!
                            <?php $link = get_permalink(); ?>

                            <p class="more"><?php echo"<a href=$link>Readmore >></a>" ?></p>

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated