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

    (@diddledani)

    Yes, this is possible but you need to add some PHP code into your theme to achieve it. Place something similar to the second block of code below into your theme’s functions.php file (if it doesn’t have such a file you can create it at wp-content/themes/<your-theme>/functions.php with the first snippet below, to which you can add the second code block as you would if the file already existed:

    <?php
    
    add_action( 'a_z_listing_item_indices', 'exclude_a_z_pages' );
    function exclude_a_z_pages( $indices, $item, $type ) {
        if ( in_array( $item->ID, array(
            5, // exclude post with ID of '5'
            6, // exclude post with ID of '6'
            7, // exclude post with ID of '7'
            // add further ID numbers here separated by commas (,) to exclude them
        ) ) {
            $indices = array();
        }
    
        return $indices;
    }
    

    The second code block needs to be either after <?php, and before ?> if it is present. This is a rule of how the PHP engine recognises that the code is PHP rather than HTML.

    • This reply was modified 5 years, 9 months ago by Dani Llewellyn. Reason: add info about tags
    Plugin Author Dani Llewellyn

    (@diddledani)

    Version 2.0.1 includes a new shortcode attribute exclude-posts that you can now use for this:

    [a-z-listing display="posts" post-type="posts" exclude-posts="1,3"]
    

    In the above shortcode I have told the plugin to remove the post with ID 1 and the post with ID 3.

    Thread Starter berekenhulp

    (@berekenhulp)

    Daniel, thanks for your answer. That’s very nice! I’m going to try it today. Thanks a lot

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Exclude specific pages’ is closed to new replies.