Dani Llewellyn
Forum Replies Created
-
Forum: Plugins
In reply to: [A-Z Listing] Ignore articles (A, An, The)Excluding posts with a specific term applied is doable with the
exclude-termsandtaxonomyparameters to the shortcode:[a-z-listing display="posts" post-type="post" taxonomy="category" exclude-terms="category-to-exclude"]The
exclude-termsparameter takes a list of terms’ slugs to exclude posts which are assigned the terms. The list is separated by commas,.Forum: Plugins
In reply to: [A-Z Listing] Ignore articles (A, An, The)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.Forum: Plugins
In reply to: [A-Z Listing] New Update needs new solution.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.Forum: Plugins
In reply to: [A-Z Listing] Everything is showing under # categoryThe 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?Forum: Plugins
In reply to: [A-Z Listing] Everything is showing under # categoryIs 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
mbstringis 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.Forum: Plugins
In reply to: [A-Z Listing] 1 letter at a time + thumbnailsThe 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.phpinto 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 thewhileloop e.g. add it on line 35. Now you have$itemcontaining 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 usefulThanks for the glowing review 🙂
I’ll try to get the readme updated with your suggestions in the next release!
Forum: Plugins
In reply to: [A-Z Listing] How to show category and subcategory name ??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 68It’s all good 🙂 Nothing to worry about whatsoever… I hope you get your problem sorted.
Forum: Plugins
In reply to: [A-Z Listing] Pagination for Woocomerce??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"]Forum: Plugins
In reply to: [A-Z Listing] theming anchor linksYou 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
Forum: Plugins
In reply to: [A-Z Listing] page loads incompletely first time, fixes with a refreshHi,
I just checked in Safari but can’t see the behaviour that you describe. What browser are you using? It might be browser-specific..
Forum: Plugins
In reply to: [A-Z Listing] Scrolling IssueThe 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
-120supplied towindow.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
Forum: Plugins
In reply to: [A-Z Listing] theming anchor linksThe 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
-120supplied towindow.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 ); }); }); }Forum: Plugins
In reply to: [A-Z Listing] My code conflict in filter tab elementorHi,
How are you adding this line?:
add_filter( 'a_z_listing_tabify', '__return_true' );You need to add it to your theme’s
functions.phpfile for it to work. You don’t need to add any extra javascript when you do this.