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

    (@diddledani)

    If you’re using the shortcode then there isn’t currently any way of excluding pages – I’ll add it to my TODO list. However, if you’re directly calling either of the functions “the_az_listing()” or “get_the_az_listing()” for the index page then the first argument can be a valid WP_Query object preloaded with your requirements for the list of posts or pages to include in the index page. There isn’t a way of doing the same with the widget currently (again, I’ll add this to my TODO).

    Can you provide an example so that we can hack our way to SUCCESS?

    – THanks

    Plugin Author Dani Llewellyn

    (@diddledani)

    to exclude a post or several posts from the query, when using the functions method of displaying the listing, you can do similar to:

    <?php
    the_a_z_listing( array( 'post__not_in' => array( 1, 2, 3 ) );
    ?>

    The array passed to ‘post__not_in’ is an array of post IDs which you want to be excluded from the listing.

    Thanks for the fast response Daniel. We are enjoying the plugin.

    Now off to review!! ??

    How would we go about doing this if we’re using the a-z-listing-multi-column.example template with version 1.0.0 of the plugin? Have been trying to hack a solution myself but no luck.

    Plugin Author Dani Llewellyn

    (@diddledani)

    sgauder, The template you use should be orthogonal to excluding pages/posts from the list. i.e. the posts selected by this code should be the same, independent of which template you use.

    Sorry, you lost me. Are you suggesting that something like this should work then?

    <?php if ( ($a_z_query->have_items()) && ($a_z_query( array(‘post__not_in’ => array(1,2,3)) ) ) ) : ?>

    I’ve tried a few options but not having any luck. I’m not using the_a_z_listing() in my template so not sure how to translate that to my template.

    Plugin Author Dani Llewellyn

    (@diddledani)

    $a_z_query is not a function.

    the_a_z_listing() is the invocation that you include in a template which then uses the a-z-listing.php template for the actual A-Z display. If you don’t want to modify or create a template to include a call to the_a_z_listing() then you can use the shortcode instead. The shortcode will use the same a-z-listing.php template for the actual A-Z display in the same way that calling the_a_z_listing() does.

    so the order of events is:

    1. WordPress receives request and assigns template from your theme
    2. your theme executes and either
    • calls the_a_z_listing() directly
    • as part of the_content executes the shortcode (if present)
    • this plugin executes the a-z-listing.php template from your theme
    • the a-z-listing.php template runs the custom loop

    Sorry, I’m not explaining myself very well at all I think.

    In the plugin, you have a templates folder with 2 files – a-z-listing.php and a-z-listing-multi-column.example.php. The a-z-listing.php file seems to indicate that if a theme requires a different layout to copy the file into the theme directory and adjust to suit the theme. I’m assuming that’s the same case with the a-z-listing-multi-column.example.php file.

    So, I don’t want to execute the_a_z_listing() directly or execute the shortcode. I need the template in my theme to use the multi-column layout with a few other minor HTML customization.

    Given that, I’m really not seeing a way to exclude a set of posts via the method you’ve described above. Is that the case? Is the only way to exclude a set of posts by using the_a_z_listing() or shortcode method?

    So sorry. I totally misread your explanation above. I’m back on track and have things working as expected.

    Many apologies for any confusion or annoyance.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Excluding page from the A-Z’ is closed to new replies.