go41

Re: Changing posts on Arthemia front page to static :: Reply by Joern

von Joern am 16. Sep. 2010 | Keine Kommentare

try this as replacement for that queries starting with $num

Code:

<?php
   $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
      if( is_front_page()) { //if is first page not paged
         $args = array(
         'posts_per_page' => 10,
         'post__in'  => get_option('sticky_posts'),
         'caller_get_posts' => 1
         );
         query_posts($args); // only ten stickies
      } else { // not frontpage
         query_posts("cat=-27,-28&caller_get_posts=1&paged=$page&posts_per_page=10"); // old normal query, set your excluded categories if you have
      }
?>

should show max. 10 stickies on frontpage

should show any normal stuff from page two

if pagnavi doesn’t work – try without
____________________
you find me on Google+, Twitter and Facebook

(von: Joern)

Hier noch 16 weitere Ergebnisse dieses Threads:

Changing posts on Arthemia front page to static

13. Sep. 2010 (von: drwhom)

thanks for your recent help on the bottom nav bar, I haven't had a chance to implement yet (or say thank-you!) but it looks sensible enough. Now - a quick one - how can I change the front page so…

Re: Changing posts on Arthemia front page to static :: Reply by f-t-cat

14. Sep. 2010 (von: f-t-cat)

I would use 'sticky posts' for that. In post editor under the 'Publish' headline you find 'Visibility: Public'here you can edit a post to 'Stick this post to the front page'Try this with any post you want to show on…

Re: Changing posts on Arthemia front page to static :: Reply by drwhom

14. Sep. 2010 (von: drwhom)

Thanks f-t-cat, very sage advice and I've stickied 10 posts that I'd like on our front page and it works a treat - funnily enough they don't crash the featured/headline post because I think it must run them by date.…

Re: Changing posts on Arthemia front page to static :: Reply by f-t-cat

14. Sep. 2010 (von: f-t-cat)

Didn't think think about this! Unfortunately WordPress adds Stickies to the total number of posts per page.Try to count the stickies you have and built the difference to the posts per page.your loop for the lower part under div id="front-list"…

Re: Changing posts on Arthemia front page to static :: Reply by drwhom

16. Sep. 2010 (von: drwhom)

Thanks for that - I've copied over the new code in place of the old bit but it's still calling the additional 10 posts onto the front page as well as the 10 stickies. Am I missing something? Weiterlesen →

Re: Changing posts on Arthemia front page to static :: Reply by Joern

16. Sep. 2010 (von: Joern)

did you also change in the last line: posts_per_page=$num ?try to echo $num and look for a number on top of your frontlistCode:<?php$num = intval(get_option('posts_per_page')) - intval(count(get_option('sticky_posts')));$page = (get_query_var('paged')) ? get_query_var('paged') : 1;query_posts("cat=-27,-28&paged=$page&posts_per_page=$num"); ?><?php echo $num; ?>it might work without…

Re: Changing posts on Arthemia front page to static :: Reply by drwhom

16. Sep. 2010 (von: drwhom)

hi Joern - do you mean that I should add an actual number in place of $num? I've tried those configurations you suggested and so far it's not working. BTW I'm changing this in the index.php in themes>arthemia>index.php - is…

Re: Changing posts on Arthemia front page to static :: Reply by Joern

16. Sep. 2010 (von: Joern)

in the last code I gave I suggested to use 10 - $num, this subtracts the $num from 10, $num is the amount of sticky posts you have.I do not know what happens if this gets 0 (zero) or a…

Re: Changing posts on Arthemia front page to static :: Reply by drwhom

16. Sep. 2010 (von: drwhom)

I love you Joern. This codeCode:<?php$num = count(get_option('sticky_posts'));$page = (get_query_var('paged')) ? get_query_var('paged') : 1;query_posts('cat=-27,-28&paged=$page&posts_per_page='. ( 10 - $num )); ?>And reducing stickies to ... Weiterlesen →

Re: Changing posts on Arthemia front page to static :: Reply by Joern

16. Sep. 2010 (von: Joern)

No.. second page shows first page again, with the same content..check how it works by disabling the plugin wp_pagenavi, if previous and next page work without the plugin.It might help to switch the plugin off and on again to solve…

Re: Changing posts on Arthemia front page to static :: Reply by drwhom

16. Sep. 2010 (von: drwhom)

Oh bum! Good job you checked! I've tried adding that code but it's still giving me the same as the front page. I'm afraid I didn't quite understand the instruction re: pagenavi. Any other thoughts? Weiterlesen →

Re: Changing posts on Arthemia front page to static :: Reply by Joern

16. Sep. 2010 (von: Joern)

I suggested to disable pagenavi plugin in 'Plugins' just to see if normal Wordpress pagination works. Arthemia switches to next(previous)_posts_link if the plugin is not used. If pagination works without the plugin we know that this old plugin is the…

Re: Changing posts on Arthemia front page to static :: Reply by drwhom

16. Sep. 2010 (von: drwhom)

Haha, like that it's "just" all you have to do I deactivated PAGE-NAVI and it still kept the stickies on page 2, so I'm at a loss! Weiterlesen →

Re: Changing posts on Arthemia front page to static :: Reply by drwhom

16. Sep. 2010 (von: drwhom)

Ahhh! Tried your last solution and now it doesn't want to show any other pages! I think I might have to admit defeat on this one. Weiterlesen →

Re: Changing posts on Arthemia front page to static :: Reply by Joern

16. Sep. 2010 (von: Joern)

right, leave the frontpage with stickies and frequent changing posts below, is better for SEO.All other stuff works as before I hopeDid you recognize your 'title' of your site on second and following pages? There should be at least: Staggered…

Re: Changing posts on Arthemia front page to static :: Reply by drwhom

17. Sep. 2010 (von: drwhom)

Thanks Joern, it makes the page pretty long but I don't think that matters too much. As for the subsequent pages - I took it off because it was screwing with our SEO - so it's easier just to have…

Autor:

Du findest mich auch auf Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

weitere forum Beiträge: