All Good Things Must Come To An End

As you all know, I have been doing WordPress plugins and supporting it for the past 6 years. These 6 years of my life, I have been through my polytechnic education, my national service as well as my university education.

I just graduated from university in December 2009 and have been looking for full-time jobs. I am offered a full-time job and will be starting work on 1st February 2010.

I regret to say that I am NOT ABLE to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

However, I WILL still update my plugins whenever I can and you still can report bugs to me via email and I will try to fix it.


Author Topic: call paginate in a wordpress page and with a custom query ?  (Read 22637 times)

0 Members and 1 Guest are viewing this topic.

Offline Vendetta

  • Newbie
  • *
  • Posts: 19
    • View Profile
I would paginate a wordpress page with a select query from the wordpress database, do you think is possibile ?

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
don't get what you mean

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline Vendetta

  • Newbie
  • *
  • Posts: 19
    • View Profile
i'd use your paginate script for have a navigation system in a wordpress page

www.example.com/examplewordpresspage/page/1
www.example.com/examplewordpresspage/page/2
www.example.com/examplewordpresspage/page/3
...

But the page is builded with information retrieved from some specific tables in wordpress db

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
yeap, if you want custom queries, it is not possible.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline Ttech

  • Official Support
  • Global Moderator
  • *****
  • Posts: 4,294
    • View Profile
If or not?
Learning and Helping one day at a time.




DevNode.org Operator - The IRC network for Programers

Offline Tyler

  • Newbie
  • *
  • Posts: 20
    • View Profile
Shoot. I came here with hopes I was doing something wrong and it's a problem that could be fixed but I, too, am trying to get this amazing plugin to work with custom queries. Are there plans to eventually make this possible, or is it too much work to actually do this?

You see, what I'm trying to do is paginate my category pages as they list all the posts in that category by title only. On the main page, I'd like to only show 5 or so posts, but on my category pages, I'd want about 20 or so titles listed. So, I'm sorta stuck. I can either go with showing only 5 or 6 titles at a time on my category pages or show 20 posts on my main page. Or, of course, I could not use your plugin for my category pages, but that would be very uncool. Regardless, none of these results are favourable. If there is any way to get around this I would love to know. My site is TwoWordHeap.com.

Thanks!

Offline Ttech

  • Official Support
  • Global Moderator
  • *****
  • Posts: 4,294
    • View Profile
I don't know, I'm sure its possible, but not at the moment. For custom queries. I'm a bit confused with what you want. But thats probbably just me. :D
Learning and Helping one day at a time.




DevNode.org Operator - The IRC network for Programers

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Tyler: On your category pages are you using the code:
Code: [Select]
<?php query_posts('posts_per_page=20'); ?> ?

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline Tyler

  • Newbie
  • *
  • Posts: 20
    • View Profile
Not quite...

Code: [Select]
<?php 
$posts 
query_posts($query_string 
'&orderby=title&order=asc&posts_per_page=20');
if (
have_posts()) : ?>

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
actually you can just do this,
Code: [Select]
<?php
$paged 
intval(get_query_var('paged'));
if(
$paged == 0) {
$paged 1;
}
$posts query_posts($query_string 
'&orderby=title&order=asc&posts_per_page=20&paged='.$paged);
?>


Then put in pagenavi code in that page to see if it works.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline Ttech

  • Official Support
  • Global Moderator
  • *****
  • Posts: 4,294
    • View Profile
Re: call paginate in a wordpress page and with a custom query ?
« Reply #10 on: 16 July 2007, 17:35 »
?
Learning and Helping one day at a time.




DevNode.org Operator - The IRC network for Programers

Offline Tyler

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: call paginate in a wordpress page and with a custom query ?
« Reply #11 on: 16 July 2007, 17:37 »
 :-\ No dice. It's behaving just as it did before. It gives me the number of pages there would be if only 5 posts were being shown. When I click on the page numbers, they just lead nowhere.

Offline Tyler

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: call paginate in a wordpress page and with a custom query ?
« Reply #12 on: 16 July 2007, 17:43 »
I was just thinking... Hopefully I can explain this without confusing everyone... Maybe I could make my main page a static page with a custom query bringing up my latest posts and just set my "Show at most: __ posts" option to define how many posts are shown on my category pages? I really hope that's not as confusing as I think it is.

EDIT: Ah but damn, that messes up my main page for using this plugin. Damn. That "solution" won't work anyways.

Offline Ttech

  • Official Support
  • Global Moderator
  • *****
  • Posts: 4,294
    • View Profile
Re: call paginate in a wordpress page and with a custom query ?
« Reply #13 on: 16 July 2007, 17:50 »
Ah... You can make it so that there is only one post on the homepage, and then possibly have PageNavi show up on all other pages exept home.
Learning and Helping one day at a time.




DevNode.org Operator - The IRC network for Programers

Offline Tyler

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: call paginate in a wordpress page and with a custom query ?
« Reply #14 on: 16 July 2007, 17:56 »
I could do that but I think having PageNavi on the home page is more important, but I guess that's a route I may have to take...  :-\
Darn... this is all very crappy.

Offline Ttech

  • Official Support
  • Global Moderator
  • *****
  • Posts: 4,294
    • View Profile
Re: call paginate in a wordpress page and with a custom query ?
« Reply #15 on: 16 July 2007, 17:58 »
Yeah, I don't know. I don't really use PageNavi. Just for testing.
Learning and Helping one day at a time.




DevNode.org Operator - The IRC network for Programers

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: call paginate in a wordpress page and with a custom query ?
« Reply #16 on: 16 July 2007, 18:11 »
Tyler: I hope you are using WP-PageNavi 2.11.

I have attached this version to test whether it will work.

Then in your code:
Code: [Select]
$paged = intval(get_query_var('paged'));
if($paged == 0) {
$paged = 1;
}
query_posts('orderby=title&order=asc&posts_per_page=3&paged='.$paged);
See if it works.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline Tyler

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: call paginate in a wordpress page and with a custom query ?
« Reply #17 on: 16 July 2007, 18:26 »
That code gives me really strange results. I get only three posts per page, as expected, but some of the posts are from entirely different categories and not all of my posts from that category show up. [note: I'm editing "category-3.php" to affect just that category] I noticed, in the code you just gave me, there's some missing code. First one you gave me...
Code: [Select]
<?php
$paged 
intval(get_query_var('paged'));
if(
$paged == 0) {
$paged 1;
}
$posts query_posts($query_string 
'&orderby=title&order=asc&posts_per_page=20&paged='.$paged);
?>

new code...
Code: [Select]
$paged = intval(get_query_var('paged'));
if($paged == 0) {
$paged = 1;
}
query_posts('orderby=title&order=asc&posts_per_page=3&paged='.$paged);

Looks like you're missing $posts = and $query_string .. Unfortunately I'm still quite the noob when it comes to PHP so I have no idea the affects of these missing pieces of code, but something went very wrong.

EDIT: I forgot to mention that I am indeed using version 2.11.

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: call paginate in a wordpress page and with a custom query ?
« Reply #18 on: 16 July 2007, 19:00 »
Tyler: I didn't think you will get to me so fast, after attaching the code, I realized it was working partially only. I have since completed it,and I tested and it works.

Actually, if I am not wrong, you can do away with the $posts = and $query_string

[attachment deleted by admin]

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline Tyler

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: call paginate in a wordpress page and with a custom query ?
« Reply #19 on: 16 July 2007, 19:09 »
Do I replace the existing 'pagenavi.php' file or place this in my plugin folder outside of the 'pagenavi' folder? I only ask because it has made a big mess of my Manage Plugins page. There is a whole lot of text in all of the fields ie. "Plugin", "Description" etc.