Does anybody understand what the easiest method to implement a listing/power grid togglable view in wordpress could be? To become more obvious: the default view shows the posts in a listing, I must have the choice to exhibit these questions power grid. I've to date produced a loop which shows just the pictures, and incorporated it in another template. But I'm not sure the way i would connect to that view. Would I better off utilizing an archive view?
Among the simplest solutions is to produce a page template that contains a power grid view and give a connect to this site within the list view. Quite simple but simply the thing you need.
I'd exactly the same problem with pagination. WordPress has built-in function posts_nav_link that instantly prints links to previous and then pages as needed. However , this function works just with $wordpress_query demonstration of Wordpress_Query (this instance can be used automatically, for instance to obtain page's content or even the latest posts home based). Therefore the solution for you personally:
<?php $temp=$wp_query; $wp_query=null; $wp_query = new WP_Query('showposts=4'); while(have_posts() ) : the_post(); ?> <?php the_post_thumbnail( array(160,160) );?> <h2><?php the_title(); ?></h2> <?php endwhile; posts_nav_link(); $wp_query = $temp; ?>
I believe that's quite apparent and there's no necessity of explanation :) ought to be working
Thanks dude. I type of first got it working for the time being with this particular:
<?php $latest = new WP_Query('showposts=4'); ?> <?php while( $latest->have_posts() ) : $latest->the_post(); ?> <?php the_post_thumbnail( array(160,160) );?> <h2><?php the_title(); ?></h2> <?php endwhile; ?>
I believe my mistake was looking to get it to make use of
get_template_part( 'loop', 'grid' ); It might show the page, but no posts. Even when used
get_template_part( 'loop', 'index' );
I'll need to determine the pagination, but I am putting it lower for the time being to operate on another thing. Interesting help to date! @Gediminas