• hi
    could you please let me know how to output the alphabet on top of every page instead of having it in the widget?
    I suppose there is a <?php code to use in template but i tried to add this

    <?php
    the_a_z_listing( array(
    ‘tax_query’ => array( array(
    ‘taxonomy’ => ‘category’,
    ‘post_type’ => ‘post’,
    ‘terms’ => array( ‘my boat’ )
    ) )
    ) );
    ?>

    in my header template but it outputs a vertical alphabet linked to nothing…
    Thanks
    Lola

Viewing 1 replies (of 1 total)
  • Plugin Author Dani Llewellyn

    (@diddledani)

    Do you want the full listing in the header of every page or just the letters? If you want the letters only then you could either use the Widget in an appropriate sidebar, or you can use the_a_z_letters() function.

    Your query in the example you posted which isn’t working is not a valid WP_Query. The post_type item needs to be at the same level as the tax_query item:

    <?php
    the_a_z_listing( array(
        'post_type' => 'post',
        'tax_query' => array(
            'taxonomy' => 'category',
            'terms'    => array( 'my-boat' ),
        ),
    ) );
    

    This function as above will show the complete listing, which might be correct, or you might want the letters only in which case replace it with a call to the_a_z_letters() instead of the_a_z_listing(). Both functions use the same argument, so the array can remain the same:

    <?php
    the_a_z_letters( array(
        'post_type' => 'post',
        'tax_query' => array(
            'taxonomy' => 'category',
            'terms'    => array( 'my-boat' ),
        ),
    ) );
    
Viewing 1 replies (of 1 total)
  • The topic ‘how to display on top of pages?’ is closed to new replies.