WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to work with an old plugin http://wordpress.org/extend/plugins/wp-ecards/ (I'm not the plugin author) and I get this error in the php error log and a blank screen when trying to view the e-card on site:

 Failed opening '' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')
 in /home/public_html/demo/wp-content/plugins/wp-ecards/ft-wp-ecards.php on line 171

I don't know what is happening. Is this plugin trying to load the pear library? Any ideas?

The function around line 171 is below (with line 171 marked as such) :

function init_wpecards_viewcard(){
    global $wp_query;
    if ( isset($wp_query->query_vars['ft_wpecards_view']) ){
        if ( $ft_wpecards_parentpost = ft_wpecards_get_post_id($wp_query->query_vars['card']) ){
            if ( ft_wpecards_get_post_type($wp_query->query_vars['card']) == 'post' ) {

                    include(get_page_template()); //LINE 171
share|improve this question
up vote 0 down vote accepted

Would it not make more sense to use get_template_part() ? What may be happening is that there is no 404 template:

if ( '' != get_query_template( '404' ) )
   include( get_query_template( '404' ) );


This may be because pretty permalinks have been turned off, or because there is no 404 page template to be found.

The same is true of your get_page_template:

  • You called query_posts but you did not call wp_Reset_query afterwards
  • get_page_template must be called within the post loop, yet there is no post loop to be found
  • you have the ID, it would be far easier to do a get_post_meta($ft_wpecards_parentpost,'_wp_page_template',true); to grab the page template filename, prefixed with the theme folder url
share|improve this answer
Thanks, I'm not the original plugin author; I'm just trying to get it to work. I do have a 404 and permalinks are on. The plugin will generate an e-card, but actually viewing the e-card URL is broken. The plugin is wordpress.org/extend/plugins/wp-ecards – markratledge Nov 16 '11 at 19:52
As I said, include(get_page_template()); needs to be inside the post loop, but you haven't got a post loop, you've left it out, the whole have_posts() the_post() etc? – Tom J Nowell Nov 16 '11 at 19:57
get_page_template() doesn't have to be called within the loop, it actually uses get_queried_object_id() which is accessible very early on. But otherwise, I think Tom is right on. It says "Failed including ''"; which indicates that get_page_template() is returning an empty string, indicating that - most likely - the code is being called somewhere other than on a Page. – goldenapples Nov 16 '11 at 20:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.