Header.php

Hi,

My website is fitloans.com.au and I am having issues with my mailchimp connection to my opt-in panda locker. I need to connect mailchimp to my website.

There is a bit of code from mailchimp that I need to update in the header.php file. I have tried to find the header.php file to update in wordpress and get an error message. My header at the moment is:

<?php // ============================================================================= // HEADER.PHP // ----------------------------------------------------------------------------- // The site header. // ============================================================================= x_get_view( 'header', 'base' ); I am trying to add the mailchimp code and I am getting the error message: Your PHP code changes were rolled back due to an error on line 11 of file wp-content/themes/x/header.php. Please fix and try saving again. syntax error, unexpected '<', expecting end of file Do you know what I should be adding to the end? Thanks

Hi @fitloans,

To help you better we need more information. Please share the mailchimp code you were adding. It is a syntax error because you might be adding JS script and not a PHP code.

Although, have you checked Email Forms that comes with X Theme. No need for codes It helps you to integrate Mailchimp account and website. Please refer following article and let us know how it goes:

If that doesn’t achieve what you want, please try Convertplus. It has Mailchimp addon too and no need to add custom code.

Thanks for the reply and suggestion to use the inbuilt email form. Unfortunately I need something that locks the download until the viewer has provided their email address. That is why I have been using Opt-in Panda.

The code that I am trying to add is as follows:

[details=Summary]

[/details]

Hi @fitloans,

Instead of adding the code in the header.php file, Please install and activate the child theme and login through FTP then edit the functions.php then add this code:


add_action('wp_head', 'add_header_code');
function add_header_code(){
?>
    <!-- ADD THE JS CODE HERE -->

    <?php
};

Hope this helps.

Thanks for that. It worked adding it to the functions.php file.

Does X theme include any content lockers? It seems like Opt-in Panda is broken so need to set up a content locker to my education download section

Hi @fitloans,

You can utilize the Classic Protect element

This will protect your content from not login user.

Hope it helps,
Cheers!

Thanks for the suggestion. So would that classic protect allow the website viewer access to downloadable content as long as they provide me with an email address? Or is this a user log in type access?

I only need a function that restricts the user access to the downloadable content until they provide an email address. This will help me build my email list.

Hey @fitloans,

The Classic Protect element will only give access to the protected content when the user log in to the site. If you want to get email list and for the downloadable contents, you may need to find other 3rd party plugin that offers the feature.

Perhaps this link might help:

Best Regards.

Thanks for the link. As I advised previously, I am using opt-in Panda that has that function. That is why I requested more information regarding your suggestion as it didn’t seem to serve the purpose I stated. Thanks for trying anyway.

You’re always welcome!

You might want to also checked this article.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.