Forum Replies Created

Viewing 15 replies - 226 through 240 (of 927 total)
  • Plugin Author Dani Llewellyn

    (@diddledani)

    The only thing I can immediately see is that you are not setting a default value to $count before the foreach loop:

    $children = get_term_children( $immediate_parent, 'category' );
    $count = 0;
    foreach ( $children as $child ) {
        $term = get_term_by( 'id', $child, 'category' );
        // add the child's count to the value used in the title
        $count += $term->count;
    }
    Forum: Plugins
    In reply to: [A-Z Listing] Add menu only
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    This is not a feature that my plugin supports 🙁

    There is, however, a small javascript file that can be included to turn the output into a “tabbed view” where the whole listing is loaded and then all the letters except one hidden from view; clicking a different letter will reveal that list and hide the previous one without reloading the page or having a different URL. To try this out, add the following code to your theme’s functions.php file:

    add_filter( 'a_z_listing_tabify', '__return_true' );
    
    Forum: Plugins
    In reply to: [A-Z Listing] Anchor offset
    Plugin Author Dani Llewellyn

    (@diddledani)

    To apply to the back-to-top links you’ll need to modify the javascript to also target those links.

    Plugin Author Dani Llewellyn

    (@diddledani)

    The widget doesn’t show the pages. It is a widget, not a listing. The widget is meant to point to a page on your site where you use the shortcode from the plugin. For example, to show pages you would add to your editor area the following shortcode:

    [a-z-listing display="posts" post-type="page"]
    
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    The foreach loop is wrong. Sorry about that:

    foreach ( $children as $child ) {
        $term = get_term_by( 'id', $child, 'category' );
        // add the child's count to the value used in the title
        $count += $term->count;
    }

    You have two numbers in parentheses because you also have the following:

    <strong><?php $a_z_query->the_title(); ?></strong> (<?php $a_z_query->the_item_post_count(); ?>)
    

    I suspect you’ll want to remove the second-half of that line – i.e. the parentheses and the content within.

    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    The easiest way to do this is to copy the template file from wp-content/plugins/a-z-listing/templates/a-z-listing.php into your theme and edit line 21 to change $_a_z_listing_minpercol = 10;. You will want to set that variable to 1:

    $_a_z_listing_minpercol = 1;
    

    Make sure you’re aware of the concept of child-themes if you are using a theme that you did not create yourself. You should use a child-theme in such circumstances so that any updates to your theme from its developer do not delete the template we copied above.

    Forum: Plugins
    In reply to: [A-Z Listing] Anchor offset
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    The script is present in the plugin as an example. It will need customisation to support each site. You can load it without customising it with the following in your theme’s functions.php:

    add_action( 'wp_enqueue_scripts', 'enqueue_a_z_scroll_fix' );
    function enqueue_a_z_scroll_fix() {
        wp_enqueue_script( 'a-z-scroll-fix', plugins_url( 'scripts/a-z-listing-scroll-fix.js', trailingslashit( WP_PLUGINS_DIR ) . 'a-z-listing/a-z-listing.php' ), array(), false, true );
    }

    The best thing to do, however, is to copy the file into an appropriate location in your theme, add any customisations – you likely need to adjust the offset, and then load from there instead of from the plugin.

    • This reply was modified 6 years, 1 month ago by Dani Llewellyn. Reason: Fix wp_enqueue_script() usage
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    It looks like you’re using a custom template, possibly copied from wp-content/plugins/a-z-listing/templates/a-z-listing.example.php.

    The a-z-listing.example.php file does not include the required markup for the columnar display to work. Instead you should either let the plugin use it’s default template by removing the template from your theme; or you should copy the template from wp-content/plugins/a-z-listing/templates/a-z-listing.php instead.

    This latter template named simply a-z-listing.php (i.e. the one that doesn’t include .example in the name) is the one that will be used when you haven’t overridden it with a template in your theme.

    Plugin Author Dani Llewellyn

    (@diddledani)

    The inbuilt styles have not been loaded because the plugin cannot detect that it is being used on the page. To force the plugin to load the styles you can add the following line to your theme’s functions.php file:

    add_action( 'init', 'a_z_listing_force_enable_styles', 99 );
    
    Forum: Plugins
    In reply to: [A-Z Listing] Az list broke
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    You have the following CSS which is causing the issue:

    .column,
    .columns {
     width:100%;
     float:left;
     padding-left:.625rem;
     padding-right:.625rem
    }

    You can reset this with the following CSS added to the theme customiser’s (navigate to wp-admin, then appearance, then customise) “Additional CSS” field to fix the problem:

    div.letter-section > ul.columns {
      float: initial;
    }
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    To display Woocommerce categories you want a shortcode similar to:

    [a-z-listing display="terms" taxonomy="product_cat"]
    
    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    It looks ok from a quick review; although, you should be aware that the _a-z-listing-extract-item-indices filter is meant for internal use so it is not guaranteed to function the same way in future versions.

    You might be able to achieve the same effect (to revert the title when you’ve overridden it for indexing) with better forward compatibility guarantees by copying the template into your theme and modifying line 57-59 to something like this:

    <a href="<?php $a_z_query->the_permalink(); ?>">
    	<?php
    	if ( 'term' === $a_z_query->get_the_item_type() ) {
    		$term = get_term( $a_z_query->get_the_item_id() );
    		echo apply_filters( 'term_name', $term->term_name );
    	} else {
    		$a_z_query->the_title();
    	}
    	?>
    </a>

    The default template is at wp-content/plugins/a-z-listing/templates/a-z-listing.php.

    Plugin Author Dani Llewellyn

    (@diddledani)

    Oh,

    I completely failed to remember that bit when I posted the above code snippet. Thanks, @filomedio, for posting the correct call.

    The purpose of that statement is that pulling the whole object will potentially slow down or break larger listings, so I wanted to make sure people really understood the implication when they use it.

    Plugin Author Dani Llewellyn

    (@diddledani)

    Sorry, @verylongelbow , I completely missed your original plea for help. I’m glad that you managed to get something working for your site, even though it’s via an alternative plugin. This is a feature that my plugin isn’t equipped to handle properly at the moment, so the likelihood is the AZIndex plugin suits your purposes better now. This is especially true as you have got your site into a working setup, which replacing the plugin again would be a “pain in the neck” (to use a British term) 🙂

    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    This is not a feature that the plugin anticipates, and so it might be complex to set up how you want it, or possibly not doable at all.

    I think you can possibly use either:

    • a_z_listing_item_index_letter to override the index letter, but leave the title unchanged, or
    • a_z_listing_pre_index_item_title to change the title

    For the first option something like this in your theme’s functions.php might work:

    <?php
    add_filter( 'a_z_listing_item_index_letter', 'override_a_z_index_letter' );
    function override_a_z_index_letter( $original_index, $item, $type ) {
        $surname = get_post_meta( $item->ID, 'surname', true );
        if ( $surname ) {
            return array( \A_Z_Listing\Strings::maybe_mb_substr( $surname, 0, 1 ) );
        }
        return $original_index;
    }

    For the second option, something like this in your theme’s functions.php might work:

    <?php
    add_filter( 'a_z_listing_pre_index_item_title', 'override_a_z_title' );
    function override_a_z_title( $original_title, $item, $type ) {
        $surname = get_post_meta( $item->ID, 'surname', true );
        if ( $surname ) {
            return $surname;
        }
        return $original_title;
    }
Viewing 15 replies - 226 through 240 (of 927 total)