Forum Replies Created

Viewing 15 replies - 151 through 165 (of 927 total)
  • Forum: Plugins
    In reply to: [A-Z Listing] Debug error
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    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.

    Plugin Author Dani Llewellyn

    (@diddledani)

    When 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.php file 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.

    Plugin Author Dani Llewellyn

    (@diddledani)

    You might find those letters are “multibyte” characters according to the Unicode standard. If this is true, you can try using mb_substr where I used substr above to fix this. You will still need those letters to be included in the alphabet, which you can do by adding the alphabet="" 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"
    
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    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
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    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-a
    • tag-slug-b
    • another-tag-slug
    • This reply was modified 5 years, 6 months ago by Dani Llewellyn. Reason: clarify tags are not all required
    Plugin Author Dani Llewellyn

    (@diddledani)

    You’re quite right, I think the $item->title should be $item->post_title.

    Plugin Author Dani Llewellyn

    (@diddledani)

    You can allow numbers to be separated by changing both instances of /^[A-Za-z]$/ to /^[A-Za-z0-9]$/.

    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    The best way to ignore the first character is to use the a_z_listing_item_index_letter filter. This can be added to your theme or child-theme’s functions.php and 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
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    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.

    Plugin Author Dani Llewellyn

    (@diddledani)

    Ahh I see. This will require a fair amount of custom coding to implement. The plugin does not support this natively.

    Plugin Author Dani Llewellyn

    (@diddledani)

    It 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.

    Plugin Author Dani Llewellyn

    (@diddledani)

    aah, my mistake. the return needs to be an array. Change return substr( $last_name, 0, 1 ); to return array( substr( $last_name, 0, 1 ) ); and that should fix it.

    Plugin Author Dani Llewellyn

    (@diddledani)

    It’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 🙂

    Plugin Author Dani Llewellyn

    (@diddledani)

    It 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_letter filter:

    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;
    }
    Plugin Author Dani Llewellyn

    (@diddledani)

    This 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.

Viewing 15 replies - 151 through 165 (of 927 total)