Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter martin.aleksander

    (@martinaleksander)

    *bump*
    Still needs help with this.

    Thread Starter martin.aleksander

    (@martinaleksander)

    Ah, never mind.. πŸ™‚
    Found a solution..

    I wrapped it in <p class="post-tags"><?php the_category(', ') ?></p>, and then put up styles for .post-tags a { }

    πŸ™‚

    Thread Starter martin.aleksander

    (@martinaleksander)

    Great!
    Worked like a charm!

    Thank you very much, Michael!

    Thread Starter martin.aleksander

    (@martinaleksander)

    Sorry to bump this again, but I really need help with it.

    <?php
     $featuredquery = "
        SELECT wposts.*
        FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
        WHERE wposts.ID = wpostmeta.post_id
        AND wpostmeta.meta_key = 'article_level'
        AND wpostmeta.meta_value = 'Hovedsak'
        AND wposts.post_status = 'publish'
        AND wposts.post_type = 'post'
        AND wposts.post_date < NOW()
        ORDER BY wposts.post_date DESC
    	LIMIT 0 , 4
     ";
     $featuredposts = $wpdb->get_results($featuredquery, OBJECT);
    ?>
    <div id="featured">
    	<ul class="ui-tabs-nav">
    		<?php if ($featuredposts): ?>
    			<?php foreach ($featuredposts as $post): ?>
    				<?php setup_postdata($post); ?>
    				<li class="ui-tabs-nav-item ui-tabs-selected" id="nav-fragment-1">
    					<a href="#fragment-1"><img src="<?php echo get('artikkelbilde'); ?>&w=80&h=50&zc=1" alt="<?php the_title(); ?>" />
    					<?php the_title(); ?></a>
    				</li>
    			<?php endforeach; ?>
    		<?php else : ?>
    			Ingen innlegg funnet
    		<?php endif; ?>
    	</ul>
    	<!-- Display the content -->
    	<div id="fragment-1" class="ui-tabs-panel">
    		<img src="http://fx.itpro.no/img?src=/<?php echo get_post_meta($post->ID, 'toppsakbilde', true) ?>&w=410&h=250&zc=1" alt="<?php the_title(); ?>" />
    		<div class="info">
    			<h2><a href="<?php the_permalink() ?>"><?php the_title();?></a></h2>
    			<p><?php excerpt('18'); ?></p>
    		</div>
    	</div>
    </div>

    Thread Starter martin.aleksander

    (@martinaleksander)

    Thanks!

    The screen-shot in that article looks very promising, so I will definitely check that out.

    Thread Starter martin.aleksander

    (@martinaleksander)

    Does anybody know how to start with this?

    Forum: Plugins
    In reply to: First post template

    I am using this code to style the first output in a query.

    Hopefully it will help you do what you want.. πŸ™‚

    <?php query_posts(''); ?>
    <?php if ( have_posts() ) { ?>
    	<?php $post = $posts[0]; $c=0;?>
    	<ul>
    		<?php while ( have_posts() ) : the_post(); ?>
    			<?php $c++;
    			if( $c == 1) : ?><!-- The first post displays like this -->
    				<li>
    					<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
    					<?php the_excerpt(); ?>
    				</li>
    			<?php else :?> <!-- The rest of the posts -->
    				<li>
    					<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
    				</li>
    			<?php endif;?>
    		<?php endwhile; ?>
    	</ul>
    <?php } else { echo "No posts"; }?>

    Thread Starter martin.aleksander

    (@martinaleksander)

    Anyone? πŸ™‚

    Thread Starter martin.aleksander

    (@martinaleksander)

    Perfect, thank you! πŸ˜€

    Thread Starter martin.aleksander

    (@martinaleksander)

    Yeah!
    Works like a charm!

    Here is my final code;

    <?php
    							query_posts('showposts=10&offset=3'); // if not in index.php, or if needed
    
    							$i=1; // initialize the counter variables
    							//$ad_cnt=1; // this line is optional to limit ads
    
    							if (have_posts()) : while (have_posts()) : the_post(); 		
    
    							if( ($i == 1) || ($i == 2) || ($i == 4) ) { ?>
    							<div class="news-section">
    							<?php }
    							if( $i == 1 ) { ?>
    							<div class="news-item-big">
    								<a href="<?php the_permalink() ?>">
    									<img src="http://fx.itpro.no/img?src=/<?php echo get_post_meta($post->ID, 'toppsakbilde', true) ?>&w=475&h=294&zc=1" alt="<?php the_title(); ?>" />
    								</a>
    								<h4><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4>
    								<?php the_excerpt(); ?>
    							<?php }
    							if( ($i == 2) || ($i == 4) ) { ?>
    							<div class="news-item alfa">
    								<a href="<?php the_permalink() ?>">
    									<img src="http://fx.itpro.no/img?src=/<?php echo get_post_meta($post->ID, 'toppsakbilde', true) ?>&w=230&h=142&zc=1" alt="<?php the_title(); ?>" />
    								</a>
    								<h4><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4>
    								<p><?php the_excerpt(); ?></p>
    							<?php }
    							if( ($i == 3) || ($i == 5) ) { ?>
    							<div class="news-item beta">
    								<a href="<?php the_permalink() ?>">
    									<img src="http://fx.itpro.no/img?src=/<?php echo get_post_meta($post->ID, 'toppsakbilde', true) ?>&w=230&h=142&zc=1" alt="<?php the_title(); ?>" />
    								</a>
    								<h4><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4>
    								<p><?php the_excerpt(); ?></p>
    							<?php } ?>
    							</div>
    							<?php
    							if( ($i == 1) || ($i == 3) || ($i == 5) ) { ?>
    							</div>
    							<?php }
    							if ( $i == 5 ) { ?>
    							<?php if( $ad_cnt <= 0 ) { // this line is optional to limit ads ?>
    								<div class="ads netboard">
    									<label class="adLabel">Annonse: <strong>NetBoard</strong> (468 x 400px)</label>
    									<img src="<?php bloginfo('stylesheet_directory'); ?>/elements/itpro468x400.jpg" />
    								</div>
    							<?php $ad_cnt++; } // this line is optional to limit ads ?>
    							<?php $i=0; }
    							$i++; //  increase counter
    
    							endwhile; //endwhile of the loop
    							if( ($i == 3) || ($i == 5) ) { echo '</div>'; } // to close open divs in some situations
    							endif; // endif of the loop
    							?>

    The final result looks like this;
    http://img52.imageshack.us/img52/4705/20100519114748.jpg

    I am going to use this code for other parts of the site too.. πŸ™‚

    I do have another question tho, and that’s about ‘the_excerpt()’
    I want to use it like this;
    <p id="ingress"><?php the_excerpt(); ?></p>
    But when I do, the code turns out like this;
    <p id="ingress"></p><p>content..</p>
    How can I use my own id/class for the_excerpt?

Viewing 10 replies - 1 through 10 (of 10 total)