grid layout default on wordpress theme
Posted
by
nathan philpott
on Pro Webmasters
See other posts from Pro Webmasters
or by nathan philpott
Published on 2011-02-11T14:11:35Z
Indexed on
2011/02/11
15:33 UTC
Read the original article
Hit count: 336
I'm having trouble with a multi-layout option on a wordpress theme sight http://sight.wpshower.com/
the traffic have the option of a grid or a list layout at the click of a button. at present the list layout is default. I am interested in making the grid layout default .
this is some of the php, i tried simply swapping the word grid for list but although this does work to an extent , if done on the loop.php page it removes the a:hover functions on the post boxes in the grid format. also if done on the index.php it switches buttons on the main index page.
any ideas??
loop.php
<div id="loop" class="<?php if ($_COOKIE['mode'] == 'grid') echo 'grid'; else echo 'list'; ?> clear">
<?php while ( have_posts() ) : the_post(); ?>
<div <?php post_class('post clear'); ?> id="post_<?php the_ID(); ?>">
<?php if ( has_post_thumbnail() ) :?>
<a href="<?php the_permalink() ?>" class="thumb"><?php the_post_thumbnail('thumbnail', array(
'alt' => trim(strip_tags( $post->post_title )),
'title' => trim(strip_tags( $post->post_title )),
)); ?></a>
<?php endif; ?>
<div class="post-category"><?php the_category(' / '); ?></div>
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<!-- <div class="post-meta">by <span class="post-author"><a
href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>" title="Posts by <?php the_author(); ?>"><?php the_author(); ?></a></span>
on <span
class="post-date"><?php the_time(__('M j, Y')) ?></span> <em>• </em><?php comments_popup_link(__('No Comments'), __('1 Comment'), __('% Comments'), '', __('Comments Closed')); ?> <?php edit_post_link( __( 'Edit entry'), '<em>• </em>'); ?>
</div> -->
<?php edit_post_link( __( 'Edit entry'), '<em>• </em>'); ?>
<div class="post-content"><?php if (function_exists('smart_excerpt')) smart_excerpt(get_the_excerpt(), 55); ?></div>
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
index.php
<?php get_header(); ?>
<div class="content-title">
Projects
<a href="javascript: void(0);" id="mode"<?php if ($_COOKIE['mode'] == 'grid') echo ' class="flip"'; ?>></a>
</div>
<?php query_posts(array(
'post__not_in' => $exl_posts,
'paged' => $paged,
)
); ?>
<?php get_template_part('loop'); ?>
<?php wp_reset_query(); ?>
<?php get_template_part('pagination'); ?>
<?php get_footer(); ?>
© Pro Webmasters or respective owner