NEED help with PHP - Adding to Thesis Single Post

Cash1t

Registered Member
Joined
May 27, 2009
Messages
80
Reaction score
35
I have tried and tried. 2 days now. So now I am asking for a little help. I have a PHP code to call a content locker that I want to add to all single posts only. I have tried several hooks with no success. I also tried adding a SINGLE POST template but could not call the actual post content. Any help would be appreciated.
 
I have tried reading your mind and hacking your server but I cannot.

Any help would be appreciated.
 
Try to explain what have you done, what did you try and what's the result/error etc for people to help you... no one really understands what you need...
 
Try to explain what have you done, what did you try and what's the result/error etc for people to help you... no one really understands what you need...
I am attempting to use CPA GATELOCK on a Wordpress site using THESIS THEME. I uploaded the files into the wp-content folder as directed. Since THESIS does not have a simple SINGLE POST TEMPLATE to edit and add the code to call the locker, I used a HOOK I found:
function do_in_post_only() { if (is_single()) { /don't show on the home page/ ?>
ERROR RECEIVED:
Parse error: syntax error, unexpected '/' in .....URL INFO.....................custom_functions.php on line 5
System deletes when I post URL info in msg
 
Last edited:
Comments using // are single, whole line comments.
Comments using /* and */ are variable length and line comments.

If you meant for it to be a comment (double slash instead of single), you would be chopping off everything from the first // including the ?> which would still product an error.
 
OK I took ALL of the comments out. I still get ERROR: Parse error: syntax error, unexpected '}' in URL INFO.....wp-content/themes/thesis_18b/custom/custom_functions.php on line 11 THIS IS THE LINE:
PHP CODE OPEN - } } add_action('thesis_hook_after_post','do_in_post_only');
 
I changed it [SEE ATTACHED]. Error msg went away but content locker doesn't come up.
 
Last edited:
Put code between [ code ] [ /code ] tags. Minus the spaces.
 
Code:
function do_in_post_only() { if (is_single())   ?>    add_action('thesis_hook_after_post','do_in_post_only');
 
SITUATION RESOLVED. While I would prefer to learn the proper HOOKS and PHP coding, I did find a solution. It's a WORDPRESS PLUGIN called "Allow PHP In Posts." Used the shortcodes and inserted the PHP and Voila!! CONTENT LOCKED! I appreciate Zapdos and seo_dude for responding to my post. Thanks
 
Code:
function do_in_post_only() 
{ 
if (is_single()) 
add_action('thesis_hook_after_post','do_in_post_only');
} 
 ?>

Probably what you wanted. You were missing the closing } bracket and the add action was out of the php delims.
 
Thank you Zapdos, I really appreciate it.
 
Back
Top