The live site is the one we are needing to resolve the issues on.
I have highlighted the issue in my previous reply. I tried adding multiple post items and the issue boiled down to the letter 'q' in the post title as the second character.
I don't know how much more information I need to provide. My currently used views and WordPress archive information have been provided.
You are not understanding what I have said. The issue is not with posts that start with 'q', but have 'q' as the second character in the word. The post Aqua Alta should be available under 'A' in the alpha listing, but it is not showing because the 'q' character is conflicting with the Toolset code for some reason.
You can see the affected page here: hidden link
The staging site is no longer applicable to this issues.
The code to manage the display of the alpha listing glossary is included below. I am not sure if it would be conflicting with the 'q' issue or not.
add_filter('wpv_filter_query', 'by_first_letter_digit_glossary', 10, 3);
function by_first_letter_digit_glossary($query, $setting, $view_id) {
global $wpdb;
if($setting['view_id'] == 5673) {
if(isset($_GET['wpvalphabet']) and $_GET['wpvalphabet'] != '' ) {
$first_char = $_GET['wpvalphabet'];
if($first_char == '0-9') {
$postids = $wpdb->get_col($wpdb->prepare(
"SELECT ID
FROM $wpdb->posts
WHERE $wpdb->posts.post_title REGEXP '^[0-9]'
AND post_type = '".$query['post_type'][0]."'
AND post_status = 'publish'
ORDER BY $wpdb->posts.post_title"));
} else {
$postids = $wpdb->get_col($wpdb->prepare(
"SELECT ID
FROM $wpdb->posts
WHERE SUBSTR($wpdb->posts.post_title,1,1) = %s
AND post_type = '".$query['post_type'][0]."'
AND post_status = 'publish'
ORDER BY $wpdb->posts.post_title",$first_char));
}
$query['post__in'] = $postids;
}
}
return $query;
}
I am starting to believe your plugin is severely broken. It is now causing critical errors within the WordPress admin without me even touching anything.
When I try to edit a page post type that has the Toolset created archive embedded on it, the following error is sent by WordPress.
I can not say anything until I review and debug the things and that is why I asked you to share the duplicator copy of your live site and also share the steps I should follow to see the above issue you shared.
The code shared using the "wpv_filter_query" hook is meant to fetch only posts that starts with the first character that you selected to be filter with. For instance - if you selected the Q it will display the only posts whose title starts with capital Q.
- hidden link
To overcome this limitation - I've adjusted the code as given under. You can just comment out existing code and add the following code:
add_filter('wpv_filter_query', 'by_first_letter_digit_glossary', 99, 3);
function by_first_letter_digit_glossary($query, $setting, $view_id) {
global $wpdb;
if($setting['view_id'] == 5673) {
if(isset($_GET['wpvalphabet']) and $_GET['wpvalphabet'] != '' ) {
$first_char = $_GET['wpvalphabet'];
if($first_char == '0-9') {
$postids = $wpdb->get_col($wpdb->prepare(
"SELECT ID
FROM $wpdb->posts
WHERE $wpdb->posts.post_title REGEXP '^[0-9]'
AND post_type = '".$query['post_type'][0]."'
AND post_status = 'publish'
ORDER BY $wpdb->posts.post_title"));
} else {
$postids = $wpdb->get_col($wpdb->prepare(
"SELECT ID
FROM $wpdb->posts
WHERE SUBSTR($wpdb->posts.post_title,1,1) = %s or $wpdb->posts.post_title LIKE %s
AND post_type = '".$query['post_type'][0]."'
AND post_status = 'publish'
ORDER BY $wpdb->posts.post_title",$first_char,'%'.strtolower($first_char).'%'));
}
$query['post__in'] = $postids;
}
}
return $query;
}
The above code will help you to search the posts whose post title will starts with the selected letter as well as it will also search for the posts whose post title having the selected letter available in-between(within) the post title .
Also I checked the view:
- hidden link
the above view is set to display only 20 posts with section "Limit and Offset" - you can change it to no limit so you can see all posts that are found.