0

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&client_id=CID&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');

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.
0

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&client_id=CID&txn_id=' . htmlspecialchars($_GET["txn_id"]) . '" width="100%" frameborder="0" height="50px"></iframe>

 <?php
     endif;
 }

1 Comment

Thanks for your assistance. My lack of php experience was saved by Open Hook plugin. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.