Hey there! any question in your mind? Ask It Now!.

Popular Categories





how to handel the slider class in wordpress?

+8 votes
274 views
asked in Programming by user8080 (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!

2 Answers

0 votes
answered by amit_pammu Expert (5,030 points)
selected by user8080
 
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         ?>
commented by user8080 (590 points)
nice its working! thanks amit_pammu
0 votes
answered by amit_pammu Expert (5,030 points)
i cant understand your problem explain it?
commented by user8080 (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>

Related Questions

+5 votes
1 answer 73 views
+1 vote
1 answer 180 views
+7 votes
7 answers 1,024 views
+4 votes
1 answer 102 views
+4 votes
1 answer 614 views
+8 votes
3 answers 121 views
+1 vote
1 answer 734 views

Not a Member yet?

Ask to Folks Login

My Account
1056 Folks are online
68 members and 988 guest online
Your feedback is highly appreciated