nick_worth
Veteran
Just Getting Started
Member Likes (0)
In crunch time with something and I really need some help. I have a custom template page that has some tabs that dynamically load some ajax content, works great. But the wp_pagenavi() properly displays when needed but does not function properly, I believe because the ?paged=# that is being added to the wrong url.
Rather than domain.com/permalink_path?paged=# I'm getting domain.com/wp-admin/admin-ajax.php?paged=# because I used wordpress's ajax when loading that content.
Thanks for any help you can provide I'm leaving town for a bit and need this fixed before I go so please be quick. Thanks again
Nick
Phoenix, United States

Responses (5)
Member (joined June 2012) Likes (0)
Attempting to resolve this myself again I've got this figured out so far. Since the content needs to load in the content div again I was wrong to think I could just change the link, I figured that out and that simply loaded the correct data on a new page. The correct approach is to remove the href from the populated wp_pagenav anchors and then run an onclick method which I've begun like this:
If I remove the ajax call made there then everything runs as expected, but as soon as I start that ajax call the entire page freezes and then breaks. Any thoughts would really help I'm running out of other options.
FYI: action = get_tv_content that is because in this same file I have this defined
Inactive (joined February 2012) Likes (0)
Hey Nick,
let me pass this onto our dev's, hopefully they can sort something for you.
Developer (joined June 2008) Likes (0)
wp_pagenavi will grab the page that it is running on and use that as the base for the permalinks, as you are finding out.
If you want to use that function, rather than write your own, then you'll need to edit it to accept a variable / $_GET of the base or page to use as the start of your url, and then update your ajax call to pass over the base or page you are calling from.
It's not going to be the easiest of things to do, as the plugin looks quite a bit more complex than I'd have expected it to be :)
Maybe this will provide some help:
http://www.mygeekpal.com/creating-an-ajax-powered-pagination-in-wordpress/
WPMUDEV-ian (joined November 2011) Likes (0)
Hello Nick,
We haven't heard on this one from you and are still waiting for a response on it.
Please advise
Cheers
PC
Member (joined June 2012) Likes (0)
Sorry I got pulled off this task for a bit because I was hitting a dead end. For a temporal solution we made the pagination area a link to the actual page 1 or 2 rather then deal with the ajax at the moment. I will be coming back to this though and I'll be sure to try your suggestion there Barry so thank you.
Become a member