go41

wp_get_archives with offset recent posts

von Joern am 26. Mrz. 2009 | Keine Kommentare

with this code:

Code:

<?php wp_get_archives('type=postbypost&limit=6'); ?>

you can easily display the last six posts in your sidebar, but how to get an offset?
On frontpage view you actually show your recent posts already, so it makes no sense to display the links to these posts again. I give you a ’switch‘ showing on a not paged frontpage recent posts with an offset (here=6). On all other views like page 2, category or tag or single you will see the last real recent posts.

Could be you have to play with ul and li, this is just a part of my sidebar.php
Code:

<?php /* If this is the frontpage and not paged only */ if ( is_home() && !is_paged()) { ?>
      <!-- recent -->
      <h3>Older Entries</h3>
      <ul>
      <?php query_posts('showposts=6&offset=6'); ?>
      <?php while (have_posts()) : the_post(); ?>
      <li><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
      <?php endwhile;  ?>
      </ul>
<?php } else { ?>
      <h3>Recent Entries</h3>
      <ul>
      <?php wp_get_archives('type=postbypost&limit=6'); ?>
      </ul>
<?php } ?>

any question? join us and ask!!
____________________
you find me on Google+, Twitter and Facebook

(von: master)

Hier noch 41 weitere Ergebnisse dieses Threads:

Moving to a different subdomain

13. Jul. 2010 (von: adamwork)

So at the moment I have everything working fine at:www.example.com/blogbut I need to move it towww.example.com/exampleWhat's the easiest way to do this?Many thanksAdam Weiterlesen →

Re: Moving to a different subdomain :: Reply by Joern

13. Jul. 2010 (von: Joern)

means you have all wordpress files in a folder /blog and want to move it to /example?I would COPY the whole stuff to a new folder, to have it twice on the server.Now actually .htaccess has to be adapted and…

How to display grid of authors

13. Jul. 2010 (von: adamwork)

I understand that you can use <?php list_authors(TRUE, TRUE, TRUE); ?> to display the list of all the authors on the site. But how would you go about setting up a grid with a picture of each author, their name,…

Re: How to display grid of authors :: Reply by Joern

13. Jul. 2010 (von: Joern)

list_authors is now wp_list_authors and loops in itself with some arguments you can set.So here you can't include the image of the 'user photo' plugin (userphoto_the_author_photo).You have to create a custom loop, a sample query for users you find here:List…

Re: How to display grid of authors :: Reply by adamwork

13. Jul. 2010 (von: adamwork)

joern thanks for getting back. the top version works well, but displays the admin.the bottom version is good, but only displays the first name over and over again.Therefore, how can I include the exlude admin into the first one?also, where…

Re: How to display grid of authors :: Reply by Joern

13. Jul. 2010 (von: Joern)

no idea how to exclude the admin in top query, you could do something like this inside the loop, it will jump the author with id=1:Code:if ( '1' == $author->ID ) { continue;}no idea again if following code will show…

Slideshow using Flash and XML in sidebar, IE pageload error

21. Jul. 2010 (von: qtest)

Hi there,I am using a flash slideshow with XML in the sidebar to display images. It works fine in Firefox and Chrome. However, in Internet explorer, the page stops loading once Flash file (swf) is loaded (it wont load the…

Re: Slideshow using Flash and XML in sidebar, IE pageload error :: Reply by Joern

21. Jul. 2010 (von: Joern)

Zafar, I do not get this slideshow.swf to display anything in any browser.To embed Adobe Flash Player it's still the best to use SWFObject 2. This a not so difficult to use and standards-friendly method to embed Flash content. You…

Re: Slideshow using Flash and XML in sidebar, IE pageload error :: Reply by qtest

22. Jul. 2010 (von: qtest)

Hi JoernThanks for your reply. There was an error on my part. I forgot to include the closing <object> tag. It's now resolved now.I always use object tag to include flash media. I'll go through the javascript method also, learn…

Moving the search bar

26. Jul. 2010 (von: drwhom)

Hi Joern, I'm finally updating all of our static content which means more content heading up to the nav bar and consequently things are getting a bit crowded. What I'd really like to do is move the search bar so…

Horrible gap in IE6 and IE7

26. Jul. 2010 (von: adamwork)

HiBetween my navigation bar, and slider, I have a horrible gap that appears in IE6 and 7I'm guessing it's to do with floats?Here's my code:Code:<div id="header-container"><div id="head" class="clearfloat">      <div class="clearfloat">         <div id="logo" class="left">            /"><img…

Re: Moving the search bar :: Reply by adamwork

26. Jul. 2010 (von: adamwork)

Hi AndrewYou still need to keep <?php include (TEMPLATEPATH . '/searchform.php'); ?>in your header, which will ensure that it appears on every page.Then just change the css, to alter it's position/colour etc.Depending on the theme your using, i... Weiterlesen →

Re: Moving the search bar :: Reply by drwhom

26. Jul. 2010 (von: drwhom)

Brilliant, thanks Adam. Sorry to ask for extra help but could you give me an idea of how style.css would change to put the form under the nav bar? Weiterlesen →

Re: Moving the search bar :: Reply by adamwork

26. Jul. 2010 (von: adamwork)

You could try something likemargin-top:40px;which might help to push it down out of the navbar... Weiterlesen →

Re: Horrible gap in IE6 and IE7 :: Reply by Joern

26. Jul. 2010 (von: Joern)

could you pls give me a link to the page with that problem?____________________you find me on Google+, Twitter and Facebook Weiterlesen →

Re: Horrible gap in IE6 and IE7 :: Reply by adamwork

26. Jul. 2010 (von: adamwork)

link removed by admin Weiterlesen →

Re: Moving the search bar :: Reply by Joern

26. Jul. 2010 (von: Joern)

Andrew, you could try to move:Code:<?php include (TEMPLATEPATH . '/searchform.php'); ?>in header.php some lines up, into your div class="right" just below the end of your oio-banner-..It will be under the banner than, you got some space thereor just copy it,…

Re: Moving the search bar :: Reply by drwhom

26. Jul. 2010 (von: drwhom)

Thanks very much for all the suggestions. Joern I think you're right it will look best above the nav bar - the only issue is that the magnifying glass looks really weak on a white background. Can I delete that…

Re: Horrible gap in IE6 and IE7 :: Reply by Joern

26. Jul. 2010 (von: Joern)

I think it's the empty div id page you find in your source code:Code:<div id="page" class="clearfloat">   <div id="top" class="clearfloat">   </div>    </div>Upper part of this starts in header.php, the following id top is in index.phptry to remove at least the…

Re: Moving the search bar :: Reply by Joern

26. Jul. 2010 (von: Joern)

this search bar is actually the file searchform.phphere you find the text to change - Search the archive...you are free to change it as well as the image arthemia/images/magnify.gifyou might try the searchform.php from the default theme of your wordpre...…

Re: Moving the search bar :: Reply by drwhom

26. Jul. 2010 (von: drwhom)

Wicked, I just added a new Go! gif into the folder and pointed it at that. Much neater. Thanks Joern. My only confusion now (!) is that when I add anything onto the nav bar it automatically adds it onto…

Re: Moving the search bar :: Reply by Joern

26. Jul. 2010 (von: Joern)

right, your navbar entries are in a div:Code:#page-bar {width:722px;}I think now you could change this toCode:#page-bar {width:940px;}and use a bigger go.gif...good luck____________________you find me on Google+, Twitter and Facebook Weiterlesen →

Re: Moving the search bar :: Reply by drwhom

26. Jul. 2010 (von: drwhom)

BLESS YOU YOU WONDERFUL INTERNET STRANGER! Weiterlesen →

Re: Horrible gap in IE6 and IE7 :: Reply by adamwork

26. Jul. 2010 (von: adamwork)

hi joernI tried removing all of the code above..... and it worked Thanks so much for your help:-) Weiterlesen →

Re: Horrible gap in IE6 and IE7 :: Reply by adamwork

26. Jul. 2010 (von: adamwork)

please could you remove url above. many thanksI can confirm it's looking good nowlink is removed, Weiterlesen →

Autor:

Du findest mich auch auf Google+, Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


weitere forum Beiträge: