//
you're reading...
Uncategorized

ABD links not showing correct letters (AP)

Alphabetic Pagination

LucyTech described an issue: I have a page with the code:
`[ap_pagination]

[list_posts post_type=”artist” orderby=”title” order=”ASC” style=”grid4″ limit=”16″]

The ABD links were showing but were not doing anything.
I would only like to display posts of a specific post type. I couldn’t see an option for this on the setup page.
I would like to show 16 posts per page for each letter with a next/pre button so users can go to the next page within each letter.
The links in the ABC were just reloading the page but not showing results for that letter.
How do I get this to work?
Thanks

https://wordpress.org/plugins/alphabetic-pagination/

I have written my own query to show a custom post type. I would like it be be listed by ABC, when you click on each letter show those letter results. How do I adjust my query to use your plugin?
My query is:
`function alphabetical_artists(){
// only run function if was artist archive page
if(is_archive (‘artist’)){
global $wpdb;

$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
$args = array(
‘posts_per_archive_page’ => 16,
‘paged’ => $paged,
‘offset’ => 0,
‘category’ => ”,
‘orderby’ => ‘title’ ,
‘order’ => ‘ASC’,
‘post_type’ => ‘artist’,
‘post_status’ => ‘publish’,
‘suppress_filters’ => true
);
//NOW YOU WILL GET RESULTS BY THIS METHOD

$the_query = new WordPress_Query( $args );

// The Loop
if ( $the_query->have_posts() ) {
echo ‘ ‘;
while ( $the_query->have_posts() ) {
$the_query->the_post();?> “>

<?php
}
echo ‘
‘;
} else {// no posts found}

}

}
add_action(‘themify_content_start’, ‘alphabetical_artists’);

Fahad said: You will find a function “ap_where()” in functions.php. Try to use it with WordPress_Query and reset the post data. It should work, if still not working, just let me know.


LucyTech, said: I can see the ap_where() but I’m not sure what you mean ‘Try to use it with WordPress_Query and reset the post data
I’ve posted my code above, can you show me how to add it to the query.

Also what settings should I set in the UI?
Implementation – custom?
Display on all lists – yes/no?
Dom Position?

Fahad replied: If you go for “Auto” settings and Display on All lists “yes”. DOM position i am not sure in your case but you can set any div “id” like “#content” or “#primary” in wordpress templates so it will work fine. For WordPress_Query i will say that there were two ways to write the query. One was that you showed in your post and the other one was custom (plain sql query). In that way you will be able to use ap_where() function’s code.


LucyTech told: I changed my code to add_filter( ‘posts_where’, ‘ap_where_clause’, 10, 2 ); $the_query = new WordPress_Query($args); return $the_query; // $the_query = new WordPress_Query( $args ); // The Loop if ( $the_query->have_posts() ) { echo

ABD links not showing correct letters

Advertisements

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: