Dani Llewellyn
Forum Replies Created
-
Forum: Plugins
In reply to: [A-Z Listing] Debug errorHi,
This is not an error, but a warning to me about upcoming changes in the PHP language specification. You can safely ignore it for now.
Forum: Plugins
In reply to: [A-Z Listing] Ignoring first symbol/letterWhen the site dies there should be some logged errors in a file on your server somewhere. This is likely called “Error Log” or “error.log” or “error_log”. It is possible that the
functions.phpfile had an error with your changes that caused the site to stop, which the error log would help us to isolate. I suspect I probably made a mistake in the code sample above.Forum: Plugins
In reply to: [A-Z Listing] A_Z by surnameYou might find those letters are “multibyte” characters according to the Unicode standard. If this is true, you can try using
mb_substrwhere I usedsubstrabove to fix this. You will still need those letters to be included in the alphabet, which you can do by adding thealphabet=""attribute to the shortcode.The default alphabet is:
alphabet="AÁÀÄÂaáàäâ,Bb,CÇcç,Dd,EÉÈËÊeéèëê,Ff,Gg,Hh,IÍÌÏÎiíìïî,Jj,Kk,Ll,Mm,Nn,OÓÒÖÔoóòöô,Pp,Qq,Rr,Ssß,Tt,UÚÙÜÛuúùüû,Vv,Ww,Xx,Yy,Zz"Forum: Plugins
In reply to: [A-Z Listing] List style typeHi,
I believe you can reinstate the list indicators with the following CSS added via the theme “customizer” in the “Custom CSS” box:
.div.letter-section > ul.az-columns { margin: initial; } .div.letter-section > ul.az-columns > li { display: initial; list-style: initial; padding: initial; }- This reply was modified 5 years, 6 months ago by Dani Llewellyn. Reason: correct the css - I used the wrong selectors
- This reply was modified 5 years, 6 months ago by Dani Llewellyn. Reason: set display:initial on the list items to override display:block in plugin code
- This reply was modified 5 years, 6 months ago by Dani Llewellyn. Reason: also reset padding on list items
Forum: Plugins
In reply to: [A-Z Listing] Filter by tagsHi,
Live-filtering, where the visitor chooses a filter and the list changes, is not possible. However, you can show a list for posts assigned to a specific tag or multiple tags with:
[a-z-listing display="posts" post-type="post" taxonomy="post_tag" terms="tag-slug-a,another-tag-slug,tag-slug-b"]This will show posts tagged with at least one of the following tags (uses the “slug” which can be found in the tags list):
tag-slug-atag-slug-banother-tag-slug
- This reply was modified 5 years, 6 months ago by Dani Llewellyn. Reason: clarify tags are not all required
Forum: Plugins
In reply to: [A-Z Listing] Ignoring first symbol/letterYou’re quite right, I think the
$item->titleshould be$item->post_title.Forum: Plugins
In reply to: [A-Z Listing] Ignoring first symbol/letterYou can allow numbers to be separated by changing both instances of
/^[A-Za-z]$/to/^[A-Za-z0-9]$/.Forum: Plugins
In reply to: [A-Z Listing] Ignoring first symbol/letterHi,
The best way to ignore the first character is to use the
a_z_listing_item_index_letterfilter. This can be added to your theme or child-theme’sfunctions.phpand will ignore any non-alphabetical letter:add_filter( 'a_z_listing_item_index_letter', 'ignore_a_z_non_alphabetical_letters_at_start_of_title', 10, 3 ); function ignore_a_z_non_alphabetical_letters_at_start_of_title( $index_letters, $item, $type ) { // if we already have an alphabetical letter, return it immediately if ( preg_match( '/^[A-Za-z]$/', $index_letters[0] ) ) { retrun $index_letters; } // loop through the title letters and return the first alphabetical letter for ( $i = 0; $i < mb_strlen( $item->title ); $i++ ) { $letter = mb_substr( $i, 1 ); if ( preg_match( '/^[A-Za-z]$/' $letter ) ) { return array( $letter ); } } // if we get here, then there are no alphabetical letters in the title so return the original index return $index_letters; }- This reply was modified 5 years, 7 months ago by Dani Llewellyn. Reason: add missing regex `//` characters
Forum: Plugins
In reply to: [A-Z Listing] Letters not showing horizontallyHi,
As it shows correctly when you are logged-in then I suspect that the problem is server-side caching of public anonymous page views. Try to find a cache clear/purge facility on your server to see if clearing the caches fixes it up.
Forum: Plugins
In reply to: [A-Z Listing] Second level of filter possible ?Ahh I see. This will require a fair amount of custom coding to implement. The plugin does not support this natively.
Forum: Plugins
In reply to: [A-Z Listing] Scroll dont worksIt looks like you have the A-Z Listing twice on the same page, but only one instance is visible. The visible instance is the second copy so the browser might be trying to navigate to the first, hidden, instance and so doesn’t scroll to anywhere because it’s invisible.
Forum: Plugins
In reply to: [A-Z Listing] A_Z by surnameaah, my mistake. the return needs to be an array. Change
return substr( $last_name, 0, 1 );toreturn array( substr( $last_name, 0, 1 ) );and that should fix it.Forum: Plugins
In reply to: [A-Z Listing] A_Z by surnameIt’s worth noting, also, that I have a premium extension for the A-Z Listing plugin that will handle names (proper nouns) at https://a-z-listing.com/product/proper-nouns-extension/. Please use whichever you would prefer; the code above should cover your use-case fine, so the extension isn’t necessary for you 🙂
Forum: Plugins
In reply to: [A-Z Listing] A_Z by surnameIt looks like you’re changing the index letter only, not changing the layout of the title itself. You can now do this in a much simpler way by using the
a_z_listing_item_index_letterfilter:add_filter( 'a_z_listing_item_index_letter', 'change_a_z_index_letters', 10, 3 ); function change_a_z_index_letters( $index_letters, $item, $type ) { // make sure we're filtering the right post type if ( 'page' === get_post_type( $item ) ) { // pull the title and get the first letter of the second word $full_name = explode( ' ', $item->post_title ); // the last word is in the last element of $title_parts so check it is there $last_name = array_pop( $full_name ); // ensure we actually found a last name if ( $last_name ) { // cut the first letter out for our index return substr( $last_name, 0, 1 ); } } // if we get here we didn't override the indices so return // those already discovered. return $index_letters; }Forum: Plugins
In reply to: [A-Z Listing] Scroll dont worksThis is not a problem with the A-Z Listing plugin. Something else on your site is intercepting the browser’s ability to scroll to the correct place on the page.
The scrolling feature is entirely browser-native with no custom code to implement it in A-Z Listing. It relies on the browser to correctly implement scrolling on
#section-anchors, which is a standardised concept. If it doesn’t work, as in your site, then some javascript you have is likely intercepting the clicks or the navigation attempt and preventing the browser from performing its default behaviour.