Ready to get started?Download WordPress


[Plugin: Exclude Pages] Plugin having no effect (7 posts)

  1. bowoolley
    Posted 5 years ago #

    Hi - any idea why the plugin doesn't work at all on this site:


    ? Any help will be appreciated!

  2. Technokinetics
    Posted 5 years ago #

    I'm not familiar with the inner workings of Exclude Pages, so can't help you diagnose the problem, but you might want to try Page Lists Plus, which offers similar functionality but uses a different method and so may not be affected by whatever it is that's preventing Exclude Pages from working on your site.

    - Tim

  3. bowoolley
    Posted 5 years ago #

    Thanks for the suggestion - I tried it, but it didn't work. (But I'm keeping it, it's great!) I'll probably have to use a different theme: the one I'm trying to use calls dp_list_pages and I can't figure out how to modify that... So no plugins using wp_list_pages have any effect.

  4. Technokinetics
    Posted 5 years ago #

    It sounds like your theme uses its own custom function for this; dp_list_pages isn't a native WP function. Check your functions.php theme file, which is where this function should be defined.

    - Tim

  5. janjabacac
    Posted 5 years ago #

    I have the same problem. The code in funtions.php says:

    '# Displays a list of pages
    function dp_list_pages() {
    global $wpdb;
    $querystr = "SELECT $wpdb->posts.ID, $wpdb->posts.post_title FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'page' ORDER BY $wpdb->posts.post_title ASC";
    $pageposts = $wpdb->get_results($querystr, OBJECT);
    if ($pageposts) {
    foreach ($pageposts as $post) {

  6. ID); ?>"><?php echo $post->post_title; ?>
  7. <?php

    Does anyone know, how to add exclude some pages ID'd to this code? Any help is very much appreciated.


  • mvpis
    Posted 4 years ago #

    I was able to solve the problem by adding " AND $wpdb->posts.post_parent = '0'" to the end of the query to exclude all sub pages. I am sure it could be modified to exclude a page by post_id

    $querystr = "SELECT $wpdb->posts.ID, $wpdb->posts.post_title FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'page''

    $querystr = "SELECT $wpdb->posts.ID, $wpdb->posts.post_title FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'page' AND $wpdb->posts.post_parent = '0'

  • riffard
    Posted 4 years ago #

    In case this does no work, you can do this.

    I just figured out how to do it. This will allow you to exclude them, while ordering them however you want if that is your preference.

    Open up the "functions.php" file for the theme and replace the portion under
    "# Displays a list of pages". It is located in your theme (/wp-content/themes/{name of your theme's folder}/functions.php


    $querystr = "SELECT $wpdb->posts.ID, $wpdb->posts.post_title FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'page' ORDER BY $wpdb->posts.post_title ASC";


    $querystr = "SELECT $wpdb->posts.ID, $wpdb->posts.post_title FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'page' ORDER BY $wpdb->posts.menu_order ASC";

    It took me three days to find this, so I figure I'd share. WordPress does not have a great support system, so if you can pass this on, please do. Please copy and paste the link to this post to other inquiries.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic