views:

25

answers:

2

I'm trying to customize a wordpress page to include an iframe which give the users a link to there download. We're using wordpress 2.9.2 with the Thesis theme 1.51. I've been trying to use thesis hooks but appears that the php is stripped from the output. Help? Suggested alternatives?

Code from custom_functions.php:

    function add_ejunkie_download_link () {
is_page('slug-url-of-page') {
?>

<?php
echo '<iframe src="https://www.e-junkie.com/ecom/rp.php?noredirect=true&amp;client_id=CID&amp;txn_id=' . htmlspecialchars($_GET["txn_id"]) . '" width="100%" frameborder="0" height="50px"></iframe>';
?>

<?php
   }
}
remove_action('thesis_hook_custom_template', 'thesis_hook_custom_template');
add_action('thesis_hook_custom_template', 'add_ejunkie_download_link');
A: 

Why the remove_action call? I really don't think you need it.

The PHP can't be stripped from the output, because it's just that... PHP. It's parsed at runtime, so it's not stripped, it's executed.

I'm guessing you just want to print the iframe when Thesis calls the thesis_hook_custom_template hook?

Have you double checked this hook is actually getting called, and that it's getting called where you expect it to?

Then try simplifying your hooked function with this;

 function add_ejunkie_download_link() {
     if (is_page('slug-url-of-page')):
 ?>

 <iframe src="https://www.e-junkie.com/ecom/rp.php?noredirect=true&amp;client_id=CID&amp;txn_id=' . htmlspecialchars($_GET["txn_id"]) . '" width="100%" frameborder="0" height="50px"></iframe>

 <?php
     endif;
 }
TheDeadMedic
Thanks for your assistance. My lack of php experience was saved by Open Hook plugin. :)
citadelgrad
+1  A: 

Though not as elegant as custom hook in custom_functions.php, Thesis Open Hook WordPress › Thesis OpenHook « WordPress Plugins is an easy way to add hooks with executable code in them.

songdogtech
Thanks for the suggestion, it's a shame that tool isn't a little better documented. It'd like to have used the is_page() but not a big deal since we only have one custom page.
citadelgrad