Mar 19, 2021 8:15 am
I want to write in a message for forum guests: "XXX users are registered. Become XXX+1". Number of users, I want to call php function. How can I add a php script to the field on the screen?
6 Replies
Mar 19, 2021 2:16 pm
you can use this code
add_action( 'wp_head', function () { ?> <script> $(document).ready(function() { $('#wpforo #wpforo-wrap .wpforo-admin-note').prepend($('<div class="usercount"> <?php $stat = WPF()->statistic(); ?> <?php echo $stat['members']; ?> users are registered. Become <?php echo $stat['members']; ?> + 1</div>')); }); </script> <?php } );
either via the Code Snippets plugin
or in the functions.php of your WP theme
you also have to add text to the admin note, to make it active
Mar 19, 2021 9:09 pm
I don't know where the problem is on your side
for me the code works without any problem
use the plugin if it doesn't work for you via functions.php
you asked for a way to add php to the admin note
the php code above is just an example, you can use your own