Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » eCommerce & Atahualpa »

Atahualpa, WHMCS, Iframe, SSL, and SEO, oh my...


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
 
Prev Previous Post   Next Post Next
  #1  
Old Mar 9, 2010, 10:59 PM
craig0927
 
2 posts · Mar 2010
Portland, OR
Send a message via MSN to craig0927 Send a message via Skype™ to craig0927
Information Atahualpa, WHMCS, Iframe, SSL, and SEO, oh my...

I just spent about the last 5 hours of my life trying to figure this out...so I thought I'd be a nice guy and share what I learned.

Scenario

As the post title suggest, I'm using the Atahualpa theme with WHMCS in an Iframe for my web hosting site. Naturally, I wanted to encrypt the WHMCS checkout process, but I didn't want to encrypt every page on the site either.

Getting WHMCS to render in an Iframe actually wasn't too bad. I needed to configure WHMCS to use my https URL for encrypted pages, etc. I also had to find some javascript that would automatically resize the Iframe to the correct height. So far, so good.

The real difficulty came whenever I started trying to SEO the site. By default, Atahualpa embeds all the CSS and javascript that it uses in the head, which isn't very SEO. Fortunately, there is a nice little option to move both of them to an external file. I also needed to move my Iframe javascript to an external file.

Problem

As anyone that has much experience with SSL has probably already figured out, this "broke" my encrypted pages making them show up as partially encrypted. Typically, this is a pretty straight forward fix...one just has to change any occurrences of http to https. However, in the Atahualpa theme, these references are dynamically generated by PHP...and it just looks at the blog home URL as configured in the WordPress settings page...so it will always be http://examplehost.com... regardless of your current URL.

For the CSS, these lines are found in the header.php file.

Code:
<?php if ( $bfa_ata['css_external'] == "External" ) { ?>
<link rel="stylesheet" href="<?php echo $bfa_ata['get_option_home']; ?>/?bfa_ata_file=css" type="text/css" media="all" />
<?php } ?>
The lines that generates the JS reference are buried a bit deeper in the functions.php file.

Code:
function add_js_link() {
	global $bfa_ata;
	if ( $bfa_ata['javascript_external'] == "External" ) { ?>
        <script type="text/javascript" src="<?php echo $bfa_ata['get_option_home']; ?>/?bfa_ata_file=js"></script>
	<?php } 
}
Solution

Rewrite the code to generate the correct URI scheme (http or https) based on the current page URL. And no...I could not just hard code the URLs with https since this would "break" my unencrypted pages causing them to show up as partially encrypted.

Since I'm not much a programmer, I borrowed some code from Google. Specifically, the javascript they use to reference their analytics script via http or https, as shown below.

Code:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
Modified for my purposes, it ends up looking like this.

For the CSS reference in header.php:

Code:
<?php if ( $bfa_ata['css_external'] == "External" ) { ?>
<script type="text/javascript">
var JsHost = (("https:" == document.location.protocol) ? "https://" : "http://");
document.write(unescape("%3Clink rel='stylesheet' href='" + JsHost + "craigshost.com/?bfa_ata_file=css' type='text/css' media='all'/%3E"));
</script>
<?php } ?>
For the JS reference in functions.php:
Code:
function add_js_link() {
	global $bfa_ata;
	if ( $bfa_ata['javascript_external'] == "External" ) { ?>
	  <script type="text/javascript">
            var JsHost = (("https:" == document.location.protocol) ? "https://" : "http://");
            document.write(unescape("%3Cscript src='" + JsHost + "craigshost.com/wp-includes/js/iframe/iframe.js' type='text/javascript'%3E%3C/script%3E"));
          </script>
	<?php } 
}
Now, my pages are more SEO (since my JS and CSS are external and not cluttering up the top of my page) and my SSL shows as fully encrypted on all the correct pages.
 

Bookmarks

Tags
iframe, partially encrypted, seo, ssl, whmcs

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Atahualpa SEO or All in one SEO debeerj Plugins & Atahualpa 4 Apr 12, 2010 10:28 PM
Should I turn on Atahualpa's SEO? lmt Center area post/pages 0 Feb 11, 2010 05:36 AM
All In One SEO vs. Atahualpa Alone Webmason Plugins & Atahualpa 6 Oct 29, 2009 03:13 PM
Advice on Using All in One SEO with Atahualpa Built in SEO Fields Romeo Kilo Plugins & Atahualpa 3 Oct 15, 2009 06:10 AM
[SOLVED] Newbie question - SEO plug ins and Atahualpa built in SEO jkgourmet Plugins & Atahualpa 1 Sep 26, 2009 04:33 PM


All times are GMT -6. The time now is 06:40 AM.


Powered by vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.