$feedburner_id declared in newsletter.php is not available in n-feedburner.php

136 views Asked by At

I have two php files namely:

  1. newsletter.php, and
  2. n-feedburner.php

Let me first tell you what is the code written in n-feedburner.php

The relevant code in the newsletter.php looks like this →

if($newsletter_provider == 'feedburner')
                    {
                        locate_template('inc/widgets/newsletter/n-feedburner.php',true,false);
                    }

But when we have this arrangement the Feedburner subscription system doesn't work.

However,

when we use this arrangement →

then things start to work. Reason I find is:

<?php echo $feedburner_id; ?> doesnt work alone in n-feedburner.php $feedburner_id: this is declared in newsletter.php so it is not available in n-feedburner.php

what is the solution? I want to keep the files separate because as API's will increases such as MailChimp, constant contact it will be important to keep the code clean.

1

There are 1 answers

3
nithinTa On BEST ANSWER

try the following, which will retrieve the file and include it.

require( locate_template('inc/widgets/newsletter/n-feedburner.php', false) ) ;

also you can pass variable to n-feedburner.php using Global variable or any similar methods.