Forum Replies Created

Viewing 15 replies - 1 through 15 (of 20 total)
  • Thread Starter functionjunkie

    (@functionjunkie)

    Oops… my bad… WP 1.5.2

    Cheers,

    Thread Starter functionjunkie

    (@functionjunkie)

    Michael,

    Hmmm…. interesting… Here’s what I’ve got in my page.php:

    <?php get_header(); ?>
    <div id="content">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h2 class="pagetitle"><?php if(is_home()) { echo 'pxLabs - Web and Interactive Agency'; } else { wp_title(''); echo' - Web and Interactive Agency'; } ?></h2>
    <?php the_content(__('Read the rest of this page &raquo;')); ?>
    <?php wp_link_pages(); ?>
    <?php edit_post_link(__('Edit'), '', '
    '); ?>
    </div>
    <?php endwhile; endif; ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Cheers,

    Justin

    Thread Starter functionjunkie

    (@functionjunkie)

    I tried using that code on index.php and home.php and it didn’t work.

    It’s supposed to be used on page.php, but I cannot seem to get it to work properly.

    Cheers!

    Justin

    Thread Starter functionjunkie

    (@functionjunkie)

    Moshu,

    I am in the process of adding all the child-pages, but I’m curious to find out if adding .php to the end of the child page filename is possible, whether by .htaccess or some other means. 🙂

    Cheers,

    Justin

    Thread Starter functionjunkie

    (@functionjunkie)

    Moshu,

    Forgot to mention. Yes, this page would be created with WP.

    Cheers,

    Justin

    Huzzah! This solved my problem too. Thanks Viper!

    Thread Starter functionjunkie

    (@functionjunkie)

    Nevermind folks I got it.

    I’m using Ryan Boren’s Page To Front plugin, which solved the problem I was having.

    Cheers,

    Justin

    Thread Starter functionjunkie

    (@functionjunkie)

    Bump?

    Thread Starter functionjunkie

    (@functionjunkie)

    Thanks Kafka, that works like a charm.

    Cheers,

    – Justin

    Thread Starter functionjunkie

    (@functionjunkie)

    Ian,

    Coming back to this again… Just upgraded to WP 1.5.1.2, and that plugin is not working again… LOL

    Checked the file for whitespace again, and it’s clean.

    <?php
    /*
    Plugin Name: Custom Posts Per Page
    Version: 1.0
    Plugin URI: http://ww.wp.xz.cn/support/6/11211
    Description: Change the number of posts per page displayed for different page types.
    Author: Based on code by rboren & brehaut
    Author URI:
    */
    $posts_per['home'] = 5;
    $posts_per['day'] = 10;
    $posts_per['month'] = 31;
    $posts_per['search'] = 10;
    $posts_per['year'] = 999;
    $posts_per['author'] = 999;
    $posts_per['category'] = 999;
    function custom_posts_per_page($query_string) {
    global $posts_per;
    $query = new WP_Query();
    $query->parse_query($query_string);
    if ($query->is_home) {
    if (preg_match("/posts_per_page=/", $query_string)) {
    $query_string = preg_replace("/posts_per_page=[0-9]*/"
    ,"posts_per_page=$num_posts_on_home"
    ,$query_string);
    } else {
    if ($query_string != '') {
    $query_string .= '&';
    }
    $query_string .= "posts_per_page=$num_posts_on_home";
    }
    }
    } elseif ($query->is_day) {
    $num = $posts_per['day'].'&order=ASC';
    } elseif ($query->is_month) {
    $num = $posts_per['month'].'&order=ASC';
    } elseif ($query->is_year) {
    $num = $posts_per['year'].'&order=ASC';
    } elseif ($query->is_author) {
    $num = $posts_per['author'];
    } elseif ($query->is_category) {
    $num = $posts_per['category'];
    } elseif ($query->is_search) {
    $num = $posts_per['search'];
    }
    if (isset($num)) {
    if (preg_match("/posts_per_page=/", $query_string)) {
    $query_string = preg_replace("/posts_per_page=[0-9]*/", "posts_per_page=$num", $query_string);
    } else {
    if ($query_string != '') {
    $query_string .= '&';
    }
    $query_string .= "posts_per_page=$num";
    }
    }
    return $query_string;
    }
    add_filter('query_string', 'custom_posts_per_page');
    ?>

    Are there any updates to this plugin? Or is WP not liking this plugin for other reasons?

    Thanks,

    Justin

    Thread Starter functionjunkie

    (@functionjunkie)

    Viper007Bond: What if you had 100 posts that month though? You really want a page 10 miles long?

    And it is displaying all posts for that month, but it’s doing it in a paged format.

    I see your point… I don’t think I want a page 10 miles long… I certainly wouldn’t expect anyone to scroll that far either. LOL!!!

    Anyways, thanks for the great plugin. Works like a charm!

    Thread Starter functionjunkie

    (@functionjunkie)

    Great… Thanks guys! Much appreciated.

    Thread Starter functionjunkie

    (@functionjunkie)

    Ah… good to know. I’m going to use the full path to the image. Thanks Jinsan.

    Where can I get these 2 apps or plugins if need be?

    – Justin

    Thread Starter functionjunkie

    (@functionjunkie)

    Ian,

    I figured out what it was…

    I found this code snippet


    ' if ($query->is_home) {
    if (preg_match("/posts_per_page=/", $query_string)) {
    $query_string = preg_replace("/posts_per_page=[0-9]*/"
    ,"posts_per_page=$num_posts_on_home"
    ,$query_string);
    } else {
    if ($query_string != '') {
    $query_string .= '&';
    }
    $query_string .= "posts_per_page=$num_posts_on_home";
    }
    }
    '

    in the perpage.php file, and replacing that with the original code solved the problem… Also, there was some whitespace in there as well, which probably didn’t help things either.

    Either way, TextDrive didn’t like it very much, but it’s fixed now, and it works beautifully! Great work!

    I’ll make sure that I blog about this plugin later today! 🙂

    Justin

    Thread Starter functionjunkie

    (@functionjunkie)

    Ian,

    Hmmm, never thought of that actually. I will take a look and post back later.

    Moshu: Thanks, I will check that out as well.

    Cheers!

    Justin

Viewing 15 replies - 1 through 15 (of 20 total)