Forum Replies Created

Viewing 15 replies - 436 through 450 (of 927 total)
  • Plugin Author Dani Llewellyn

    (@diddledani)

    Excluding posts with a specific term applied is doable with the exclude-terms and taxonomy parameters to the shortcode:

    [a-z-listing display="posts" post-type="post" taxonomy="category" exclude-terms="category-to-exclude"]
    

    The exclude-terms parameter takes a list of terms’ slugs to exclude posts which are assigned the terms. The list is separated by commas ,.

    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    Ignoring articles like “A”, “An”, “The” etc. is possible but will require some custom coding to implement. There is a filter which you can hook called a_z_listing_item_index_letter. You will need to create a function that returns the appropriate letter(s) for a post or term according to your own rules. The returned value must be an array of letters.

    Plugin Author Dani Llewellyn

    (@diddledani)

    Do you definitely have at least one post tagged with the tag you are setting in the short-code? If you have no posts with the tag then WP_Query (part of WordPress) will counter-intuitively return all posts, not none.

    Plugin Author Dani Llewellyn

    (@diddledani)

    The page looks correct to me. The # category is correctly elided, because there are no posts within, and the posts shown are all filtered into the correct categories. Could you elaborate a bit further on how the listing is broken because I can’t see any incorrect behaviour in your linked page?

    Plugin Author Dani Llewellyn

    (@diddledani)

    Is it OK for you to share the address to your A-Z page?

    I’m not sure why the posts would all filter into the # category unless the alphabet has become confused. Are the alphabet letters that the plugin is using matching at least some of your posts’ first letter of their title? Could you give me an example of one or several posts’ titles that have been filtered into the wrong category (in lieu of a link to your site)?

    Also, could you try to find out what PHP version your site is running and whether the PHP module called mbstring is enabled? – I have put workarounds in place for sites that don’t have mbstring, but I haven’t got automated tests that prove their correct operation yet so I might not have got it working properly for such setups.

    Plugin Author Dani Llewellyn

    (@diddledani)

    The first of your requirements is not possible via my plugin. You can only load the whole listing, not a part of it.

    Your second requirement is achievable by copying the file from the plugin folder at templates/a-z-listing.php into your theme and removing the part near the top that calls $a_z_query->the_letters().

    To add a thumbnail you need to again copy the file from the plugin’s templates folder into your theme (edit the file you copied above). You will want to add code that calls $item = $a_z_query->get_the_item_object( 'I understand the issues!' ); inside the while loop e.g. add it on line 35. Now you have $item containing your post or term you can call the WordPress-provided functions as you would elsewhere in your theme.

    Forum: Reviews
    In reply to: [A-Z Listing] Very useful
    Plugin Author Dani Llewellyn

    (@diddledani)

    Thanks for the glowing review 🙂

    I’ll try to get the readme updated with your suggestions in the next release!

    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    The class name “no-posts” applied to the HTML source code is a historical artefact that I don’t want to change because it will break any CSS styles that people are currently using. It doesn’t mean anything beyond there being no items to display. The fact that it includes the word “posts” does not indicate that the plugin is trying to display posts instead of terms.

    The taxonomy attribute needs to be the slug of the taxonomy. This is likely different from the name of the taxonomy. To find the slug, navigate to your administration screen and find the link “All brands” under the menu item on the left for one of your post-types e.g. posts (this is English, so you will likely see a translated version of this). Once you have found the link click it and then look in your web browser’s address bar. You should see an address similar to https://example.com/wp-admin/edit-tags.php?taxonomy=brands&post_type=post. Here the taxonomy name is “brands” so that is what I need to enter into the shortcode.

    Forum: Plugins
    In reply to: [A-Z Listing] PHP Error 68
    Plugin Author Dani Llewellyn

    (@diddledani)

    It’s all good 🙂 Nothing to worry about whatsoever… I hope you get your problem sorted.

    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    yes you can! 🙂 You will want to try a shortcode similar to this:

    [a-z-listing display="posts" post-type="product"]
    

    If you want to restrict to products assigned to particular categories you can do:

    [a-z-listing display="posts" post-type="product" taxonomy="product_cat" terms="category-to-use,another-category"]
    
    Plugin Author Dani Llewellyn

    (@diddledani)

    You could try the following Javascript adapted from your own:

    jQuery(document).ready(function() {
        change_anchor = document.getElementsByClassName('az-links');
        jQuery(change_anchor).find('a').each(function(){
            this.setAttribute('href', this.getAttribute('href').replace('#', '!#/'));
        });
    });
    • This reply was modified 7 years, 3 months ago by Dani Llewellyn. Reason: fix code formatting
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    I just checked in Safari but can’t see the behaviour that you describe. What browser are you using? It might be browser-specific..

    Plugin Author Dani Llewellyn

    (@diddledani)

    The anchors use the browser’s inbuilt functionality for scrolling the page to the appropriate position. This means that if you have anything on the page that is floating at the top of the window when you scroll it will obscure the target of the anchor. Browsers are unaware of these design decisions so you need to use javascript to intercept the anchor. The javascript below will move the page an extra 120 pixels down from the top of the viewport (the value -120 supplied to window.scrollBy()):

    if ( document.readyState === 'loading' ) {
        document.addEventListener('DOMContentLoaded', fixAZListingScroll);
    } else {
        fixAZListingScroll();
    }
    function fixAZListingScroll() {
        document.querySelectorAll( '.az-links a[href^="#letter-"]' )
        .forEach( function( a ) {
            a.addEventListener( 'click', function( e ) {
                e.preventDefault();
                const selector = this.href.replace( /.*(#letter-.*)/, '$1' );
                document.querySelector( selector ).scrollIntoView();
                window.scrollBy( 0, -120 );
            });
        });
    }

    Translations are handled by the WordPress.org GlotPress project. You can translate the plugin at https://translate.wordpress.org/projects/wp-plugins/a-z-listing

    Plugin Author Dani Llewellyn

    (@diddledani)

    The anchors use the browser’s inbuilt functionality for scrolling the page to the appropriate position. This means that if you have anything on the page that is floating at the top of the window when you scroll it will obscure the target of the anchor. Browsers are unaware of these design decisions so you need to use javascript to intercept the anchor. The javascript below will move the page an extra 120 pixels down from the top of the viewport (the value -120 supplied to window.scrollBy()):

    if ( document.readyState === 'loading' ) {
        document.addEventListener('DOMContentLoaded', fixAZListingScroll);
    } else {
        fixAZListingScroll();
    }
    function fixAZListingScroll() {
        document.querySelectorAll( '.az-links a[href^="#letter-"]' )
        .forEach( function( a ) {
            a.addEventListener( 'click', function( e ) {
                e.preventDefault();
                const selector = this.href.replace( /.*(#letter-.*)/, '$1' );
                document.querySelector( selector ).scrollIntoView();
                window.scrollBy( 0, -120 );
            });
        });
    }
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    How are you adding this line?:

    add_filter( 'a_z_listing_tabify', '__return_true' );
    

    You need to add it to your theme’s functions.php file for it to work. You don’t need to add any extra javascript when you do this.

Viewing 15 replies - 436 through 450 (of 927 total)