• Hi, I am looking for some help to exclude content from my subpages. Currently I have a few articles set up on my home page. If someone uses the search on the template, the articles remain on the sub page search result page. I just want the results of my query.

    I am guessing that I would use some function like is_page(); or something similar to make this so they dont show up anywhere but my home page?

    Any help would be great. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    In order to hide the page from the menu or on the list. This should be the code for the menu in your theme:

    <?php wp_list_pages(’sort_column=menu_order&depth=1&title_li=’);?>

    Replace with this sample code if I was excluding page 8:

    <?php wp_list_pages(’depth=1&sort_column=menu_order&exclude=8&title_li=’ . __(”) . ” ); ?>

    If you wantr to exclude more than one page then do it by simply adding a comma between each page number:

    <?php wp_list_pages(’depth=1&sort_column=menu_order&exclude=8,17&title_li=’ . __(”) . ” ); ?>

    This code will exclude 8 and 17 pages from the blog page menu. You can change the page number according to your requirement.

    Thread Starter magicfun1

    (@magicfun1)

    I am not excluding pages, but rather an include statement. I don’t want this to show up in my search page.

    https://www.refi-home-loan.com is my website I am trying to get rid of the 3 articles to the left on sub pages.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘proper function to exclude on subpage’ is closed to new replies.