Hi folks
I need a fix for the plugin WP-Snap or way to get the functionality of the plugin through hardcoding. My problems with the plugin are:
1. the category template page where I use the plugin doesn't create pages of 10 posts apiece as I've selected in the Wordpress settings.
2. Adding "query posts" coding to limit the number of posts displayed causes wp-snap to break and no longer display only posts starting with a certain letter.
3. Since I moved from my MAMP server to 1and1 hosting I get errors when I use the "firstload=recent" option and the cursor won't change to a hand when mousing over the letters (I can live with that though it may be indicative of a larger problem).
A fix would be best as WP-Snap provides a lot of great options but ultimately I just need to get something functional.
The offending page can be found here http://www.ksuptemp.com/?cat=5. It's built off the Branford Magazine theme
thanks
Chris Bavota answers:
The plugin obviously doesn't have a pagination script built in so your "All" page will just list all your posts without breaking them up in pages. It would probably take a bit of re-writing to go in and add the functionality, and then you would never be able to upgrade the plugin since that would overwrite the mod.
This piece of CSS is causing your cursor to turn to the text icon:
ol.snap_nav li.snap_selected a {
cursor: text;
}
It is on line 134 in the nav.css file.
rilwis answers:
This plugin gets all posts using raw query, then modify (not using query_post function) global variable $wp_query to assign matched posts.
To display correct number of posts, I added this code below to line 410:
$paged = get_query_var('paged');
$paged = empty($paged) ? 1 : $paged;
$posts_per_page = get_option('posts_per_page');
$offset = ($paged - 1) * $posts_per_page;
$wp_query->max_num_pages = ceil(count($all_posts) / $posts_per_page);
$all_posts = array_slice($all_posts, $offset, $posts_per_page);
You can grab the full file here: http://pastebin.com/WxTP7kqY
Joe Jenkins answers:
It doesn't give you the bar with the letters, but a great way to get alphabeticised posts shown is by using this plugin:
http://web-argument.com/wordpress-alphabetical-list-plugin
You get to choose which categories to use it on, and it is the one I'm using to create a publisher's site.
Chris Lee answers:
I have no idea what the code looks like so i can only provide you what the query code would be as throwing darts blindfolded.
If you want to sort the posts by title:
<?php $q = new WP_Query(
'orderby'=>'title',
'postsperpage' =>'-1',
'numberposts', =>'-1',
'post_status'=>'published'
);
?>
Then you'll want to do the typical loop & reference your query:
<?php if ($q->have_posts()) : while ($q->have_posts()) : $q->the_post(); ?>
darryl crosby comments:
the first bit of code causes a syntax error in the "orderby" line