1
DevilsWolf
Wordpress posts paged
  • 2005/2/20 9:59

  • DevilsWolf

  • Just popping in

  • Posts: 2

  • Since: 2005/2/10


I'm trying to make wordpress devide my posts over multiple pages. Its too much to show 31 posts of one month on one page and if i just limit it to 10 then most people wont read any further :p.

I've enabled the "posts paged" option and read on the official wordpress site that you have to add the "posts_nav_link()" tag in index.php where you want your page navigations displayed.
Quote:
<?php posts_nav_link('separator','previous','next'); ?>

Displays navigation showing next and previous pages if the "posts paged" option is set. This tag should be inserted out of the Word Press loop (The Loop), usually immediately after it.


But where do I have to add it exactly? The index.php which they show in the documents of the original wordpress isn't the same as the one in the XOOPS module.

This is the index.php of the XOOPS wordpress module:
Quote:
<?php
/* Don't remove these lines. */
$blog = 1;
include("header.php");
if (preg_match('/DoCoMo/', $_SERVER['HTTP_USER_AGENT']) and file_exists(dirname(__FILE__)."/wp-ktai.php")) {
header('Location: ' . XOOPS_URL.'/modules/wordpress'.(($wp_id=='-') ?'':$wp_id)."/wp-ktai.php\n");
}
wp_head();
// Uncomment the next line if you want to track blog updates from weblogs.com
//include_once(ABSPATH.WPINC.'/links-update-xml.php');
if (file_exists(XOOPS_ROOT_PATH.'/modules/wordpress'.(($wp_id=='-') ?'':$wp_id).'/themes/'.$xoopsConfig['theme_set'].'/index-template.php')) {
$themes = $xoopsConfig['theme_set'];
} else {
$themes = "default";
}
include(XOOPS_ROOT_PATH.'/modules/wordpress'.(($wp_id=='-') ?'':$wp_id).'/themes/'.$themes.'/index-template.php');
include(XOOPS_ROOT_PATH."/footer.php");
?>


Did anyone find this out?

thanks in advance

2
DevilsWolf
Re: Wordpress posts paged
  • 2005/3/10 18:34

  • DevilsWolf

  • Just popping in

  • Posts: 2

  • Since: 2005/2/10


Allright, 20 days later....

Thanks to NobuNobu the developer of the WordPress XOOPS Module, I have found the answer. I thought I'd share it with you guys incase someone has the same problem.

In order to make changes to the index you can't just change the default /modules/wordpress/themes/default/index-template.php. You'll have to create a new directory in that same themes directory with the same name as your XOOPS theme (don't delete the default one). Then just copy the files you want to change (in this case index-template.php) from the default dir to the new theme dir you just created.

Edit index-template.php (in your new theme's dir) and add <?php posts_nav_link('separator','previous','next'); ?> outside of the post loop (usually at the bottom). If you enter it within the post loop it'll keep repeating itself after every post, so make sure its outside the post loop.

Double check to see if you have your wordpress set to "post paged" in its options and it should work fine.

Again, all credits to NobuNobu for helping me out.

3
artigas
Re: Wordpress posts paged
  • 2005/3/10 18:45

  • artigas

  • Quite a regular

  • Posts: 208

  • Since: 2004/12/21


Greetings -

Is this enhancement available for downloading?

Thanks In Advance.

4
toddherrold
Re: Wordpress posts paged

thanks for the insights. unfortunately, i tried this but it didn't do anything. it doesn't seem like the addition of the XOOPS template directory in the wordpress theme directory did anything. do you have to "turn it on" or something?

5
annabloom
Re: Wordpress posts paged
  • 2005/3/12 3:12

  • annabloom

  • Just popping in

  • Posts: 7

  • Since: 2004/9/13


Quote:
<?php posts_nav_link('separator','previous','next'); ?>
this put into index-template.php outside the loop works fine, example.
i did not create a separate directory though.

6
Calipsy
Re: Wordpress posts paged
  • 2005/3/12 4:10

  • Calipsy

  • Just popping in

  • Posts: 87

  • Since: 2003/4/30


That's great. I did the changes and now I have my posts paged.

Thanks Devilswolf for sharing that!
That's the spirit!

7
toddherrold
Re: Wordpress posts paged

After several unsuccessful attempts I finally got it to work and thought it might be helpful to other newbies to post the exact code here. . . It will save you some time futzing with it. My index-template.php file within the new directory with the same name as my default theme is:

Quote:
<?php /* Don't remove this line */ if (!defined('XOOPS_ROOT_PATH')) { exit; }?>
<?php //This is WordPress main content Template ?>
<div id="wpMainContent">
<?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>

<?php the_date('','<h2>','</h2>'); ?>

<div class="post">
<h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<div class="meta"><?php echo _WP_TPL_FILED_UNDER ?><?php the_category() ?> - <?php the_author_posts_link() ?> @ <?php the_time() ?> <?php edit_post_link(); ?></div>

<div class="storycontent">
<?php the_content(); ?>
<br clear=left>
</div>

<div class="feedback">
<?php link_pages('<br />Pages: ', '<br />', 'number'); ?>
<?php comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS); ?>
</div>

<!--
<?php trackback_rdf(); ?>
-->
<?php } } else { // end foreach, end if any posts ?>
<?php include(dirname(dirname(dirname(__FILE__))) . '/wp-comments.php'); ?>
</div>


<p>Sorry, no posts matched your criteria.</p>

<?php } ?><font size=2><b><?php posts_nav_link(' | ','<- Previous','Next ->'); ?></font></b>
<p class="credit"><?php echo $wpdb->querycount; ?> queries. <?php timer_stop(1); ?> sec.<br /><cite>Powered by <a href="http://www.kowa.org/" title="NobuNobu XOOPS"><strong>WordPress Module</strong></a> based on <a href="http://wordpress.xwd.jp/" title="Powered by WordPress Japan"><strong>WordPress ME</strong></a> & <a href="http://www.wordpress.org/" title="Powered by WordPress"><strong>WordPress</strong></a></cite></p>
</div>


You can edit text within the quotes, so that the "separator" is anything you want. I chose ' | ' and the 'next' and 'previous' are likewise anything you want, like forward, back or whatever.

Login

Who's Online

148 user(s) are online (87 user(s) are browsing Support Forums)


Members: 0


Guests: 148


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits