The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Cannot add php code...
 
Share:
Notifications
Clear all

Limited Support

Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed.
We appreciate your patience and understanding, and we’ll resume our usual support by the end of August.

 

[Solved] Cannot add php code in theme files

6 Posts
2 Users
0 Reactions
1,043 Views
Posts: 9
 Baze
Topic starter
(@baze)
Active Member
Joined: 3 years ago

Hi guys,

 

i'm trying to embed the users avatar from jReviews into the comments, so i've created template override which works fine in /wp-content/themes/mytheme/wpdiscuz/layouts/1/avatar.html, but then when i add the php code there nothing happens, only the html is rendered. Can you please let me know how can i sort this out?

 

thanks,

Baze

5 Replies
Asti
Posts: 8075
 Asti
Support
(@asti)
Illustrious Member
Joined: 8 years ago

Hello Baze,

Please let us know what code have you added to the file? 

Posts: 9
 Baze
Topic starter
(@baze)
Active Member
Joined: 3 years ago

Any php code is not rendered, not even a simple echo, and currently i have this but on the front end i don't see anything:

<?php
    	require_once ABSPATH.'/wp-content/plugins/jreviews/jreviews/framework.php';
    S2App::import('Component','userprofiles_profile','jreviews');

S2App::import('Model','everywhere_com_content','jreviews');
    $profile = UserprofilesProfileComponent::getOneProfile($userId = null);
    echo $profile;
?>
1 Reply
 Baze
(@baze)
Joined: 3 years ago

Active Member
Posts: 9

So i've just seen that the system actually puts the code in comments, this is the output:

<!--?php
    	require_once ABSPATH.'/wp-content/plugins/jreviews/jreviews/framework.php';
    S2App::import('Component','userprofiles_profile','jreviews');

S2App::import('Model','everywhere_com_content','jreviews');
    $profile = UserprofilesProfileComponent::getOneProfile($userId = null);
    echo $profile;
?-->
Posts: 9
 Baze
Topic starter
(@baze)
Active Member
Joined: 3 years ago

Even this is only showing the avatar and the author name, not the echo

<div class="{AVATAR_WRAPPER_CLASSES}">
    {AVATAR}
   <div class="auth">{AUTHOR}</div>
   <?php echo "baze"; ?>
</div>
1 Reply
Asti
 Asti
Support
(@asti)
Joined: 8 years ago

Illustrious Member
Posts: 8075

@baze,

This is an HTML file, you can't add the PHP file there. You should create some shortcode like {CUSTOM_SHORTCODE}, use the wpdiscuz_comment_end hook and replace the shortcode in the $commentOutput parameter.

Share: