Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

this code here

<div class="col">
        <?php gab_dynamic_sidebar('Subnews1');?>

        <?php
        $postnr = of_get_option('of_wn_nr8') + of_get_option('of_wn_nr8a');
        if (intval($postnr) > 0 ) { ?>
            <span class="catname"><a href="<?php echo get_category_link(of_get_option('of_wn_cat8'));?>"><?php echo get_cat_name(of_get_option('of_wn_cat8')); ?></a></span>
            <?php
            $count = 1;
            $args = array(
             'post__not_in'=>$do_not_duplicate,
              'posts_per_page' => $postnr,
              'cat' => of_get_option('of_wn_cat8', 1)
            );
            $gab_query = new WP_Query();$gab_query->query($args); 
            while ($gab_query->have_posts()) : $gab_query->the_post(); if (of_get_option('of_dnd') == 1) { $do_not_duplicate[] = $post->ID; }
            ?>
            <div class="featuredpost<?php if($count == of_get_option('of_wn_nr8') or $count == $postnr) { echo ' lastpost'; } ?>">


                <?php if ($count <= of_get_option('of_wn_nr8')) { ?>

                    <h2 class="posttitle">
                        <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf( esc_attr__( 'Permalink to %s', 'wpnewspaper' ), the_title_attribute( 'echo=0' ) ); ?>" ><?php the_title(); ?></a>
                    </h2>                       
                    <div class="opinion_wrapper">
                    <?php
                        gab_media(array(   'imgtag' => 1,   'link' => 1,
                            'name' => 'wn-subnews',
                            'enable_video' => 0,
                            'catch_image' => of_get_option('of_catch_img', 0),
                            'enable_thumb' => 1,
                            'resize_type' => 'c',
                            'media_width' => 120, 
                            'media_height' => 103, 
                            'thumb_align' => 'alignleft',
                            'enable_default' => 0
                        ));
                    ?>  
                    <div class="opinion_marker"><!-- opinion marker --></div>                   
                    </div>
                    <p><?php echo string_limit_words(get_the_excerpt(),27); ?>&hellip;</p>

                    <?php gab_postmeta(); ?>
                <?php } else { ?>

                    <a class="listtitle" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf( esc_attr__( 'Permalink to %s', 'wpnewspaper' ), the_title_attribute( 'echo=0' ) ); ?>" ><?php the_title(); ?></a>

                <?php } ?>

            </div><!-- .featuredpost -->
            <?php $count++; endwhile; wp_reset_query(); ?>
        <?php } ?>
    </div><!-- .col -->

, is this, shown in this image here http://d.pr/i/7efk ,

on this site http://dev.dmichel.net/adv/ .

what i need to happen is to show all 4 posts, rather than just 1.

What I tried to do to show all 4 posts is this

<?php
            $count = 1;
            $args = array(
              'posts_per_page' => 4,
              'cat' => of_get_option('of_wn_cat8', 1)
            );
            $gab_query = new WP_Query();$gab_query->query($args); 
            while ($gab_query->have_posts()) : $gab_query->the_post(); }
            ?>

But it doesn't seem to work.

I'd like help showing all 4 posts above the titles

share|improve this question
    
Hi Danny. Are you asking for help with jQuery? –  Aliyah Feb 19 '13 at 21:36
    
the weird thing is that its equally as much jquery as it is wordpress, but i have the jquery part down jsfiddle.net/AsScy –  Danny Michel Feb 19 '13 at 21:42
    
So you don't need help making the toggle effect? Im confused. Please, can you re-edit your question to specify the exact problem you are facing? It will be easier for people to help. –  Aliyah Feb 19 '13 at 21:45
    
I have the toggle effect down jsfiddle.net/AsScy i just need to figure out ho wto display all 4 articles –  Danny Michel Feb 19 '13 at 21:45
    
All 4 articles at once? Or ... you have 4 articles that you want to appear once you toggle them? –  Aliyah Feb 19 '13 at 21:46
show 3 more comments

1 Answer

up vote 2 down vote accepted

I created a fiddle for anyone that is interested HERE.

Here is the javascript I used also to give the smooth scroll for an article container.

// clicking the links in the article link container
$('#article-links a').click(function() {
    var $this = $(this);    // save this instance of the click for access inside the loop

    // loop through all the article links and store the numeric value
    $('#article-links a').each(function(al) {
        // if the link being looked at currently matches the html/text of the link that was selected then
        if ($(this).html() == $this.html()) {
            // set the scroll position by multiplying the article previews height by the ordered number link
            // that was selected (i.e 500*1 will scroll the preview div up/down to scrollTop: 500)
            var articlePos = parseInt($('#article-preview').height())*al;

            // animate the scroll for a smooth scroll               
            $('#article-preview').animate({ scrollTop: articlePos });
        }
    }); 
});
share|improve this answer
    
Thank you steven. You can bet I'll be using this in my theme. –  Aliyah Feb 19 '13 at 22:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.