Title: include php file
Last modified: August 30, 2016

---

# include php file

 *  Resolved [wordpressuser1973](https://wordpress.org/support/users/wordpressuser1973/)
 * (@wordpressuser1973)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/include-php-file/)
 * Grateful for advice.
 * I’m trying to include a php file–a disclaimer that needs to show up on a subset
   of posts.
 * I’ve read related codex topics and forum discussion. Following what’s there, 
   I gave each of the following a try in the body of the post:
 * > <?php include “mydisclaimer.php”; ?>
 * and
 * > <?php get_template_part(‘mydisclaimer.php’); ?>
 * (Also tried the above with the full path. This should be easy. Clearly, I’m misunderstanding
   the how-to.
 * Again, grateful for advice.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [wordpressuser1973](https://wordpress.org/support/users/wordpressuser1973/)
 * (@wordpressuser1973)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/include-php-file/#post-6888688)
 *  [Frank Thoeny](https://wordpress.org/support/users/frank-t/)
 * (@frank-t)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/include-php-file/#post-6888695)
 * The function that is inside of mydisclaimer.php could be called by using the 
   Shortcode API, if you want to cast the function into a post/page.
 * Make sure <?php include “mydisclaimer.php”; ?> is correctly included inside of
   the functions.php in the theme. You should use include_once for this case so 
   it does not call into the page twice through the WP Loop.
 * If your function name, for example, is myDisclaimerFunction() then you could 
   add the shortcode like below inside the functions.php:
    add_shortcode( ‘mydisclaimer’,‘
   myDisclaimerFunction’ );
 * Then on the page/post put your shortcode in.
    [mydisclaimer]
 * Must use **return** for the value, don’t use echo with the Shortcode API.
 *  Thread Starter [wordpressuser1973](https://wordpress.org/support/users/wordpressuser1973/)
 * (@wordpressuser1973)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/include-php-file/#post-6888697)
 * Thanks, Frank! I’m on it. Much appreciated!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘include php file’ is closed to new replies.

## Tags

 * [php include](https://wordpress.org/support/topic-tag/php-include/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [wordpressuser1973](https://wordpress.org/support/users/wordpressuser1973/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/include-php-file/#post-6888697)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
