how to call a function only in specific pages and exclude it from other pages

I have the below functions

require_once(GABFIRE_FUNCTIONS_PATH. '/review-options.php');
require_once(GABFIRE_FUNCTIONS_PATH . '/custom.php');
require_once(GABFIRE_FUNCTIONS_PATH . '/shortcodes.php');
require_once(GABFIRE_FUNCTIONS_PATH . '/post-types.php');

i want them to be called only on specific page or exclude from specific pages.

Read More

I’m confused on how to do this in function.php please help!

the functions i showed above, does conflict with Q&A plugin. this takes place in qa pages. once i try to answer a question, the answer doesn’t appear.answers appears only if i remove those functions. Thus I’m looking for a way how I can disable calling those function in qa_pages

Related posts

Leave a Reply

1 comment

  1. if you know which page id , for example , you can change your page.php

    if ( get_the_ID() == '99' ) {
           my_specific_page_99_calls();
    }
    

    and then on functions.php

    my_specific_page_99_calls(
         require_once(GABFIRE_FUNCTIONS_PATH. '/review-options.php');
         require_once(GABFIRE_FUNCTIONS_PATH . '/custom.php');
         require_once(GABFIRE_FUNCTIONS_PATH . '/shortcodes.php');
         require_once(GABFIRE_FUNCTIONS_PATH . '/post-types.php');
    )
    

    i’m sure there’s other options, but this will get you there.

    to exclude from specific pages

    if ( !in_category('cake') {
           my_specific_page_99_calls();
    }