Support » Plugin: Shortcode Exec PHP » [Plugin: Shortcode Exec PHP] Need help adapting a snippet to work with plugin

  • I’m trying to adapt this code snippet to work with this plugin.

    I’ve removed all the php tags and html, but I keep getting various errors that I don’t understand how to fix (I’m not a coder…)

    I’ve been able to get other snippets to work, just not this one.

    <?php if($multi_site_on == "true"){
    if( function_exists('get_sitestats')) { ?>
    <div class="site-stats"><span><?php _e("Currently powering",TEMPLATE_DOMAIN); ?> <?php
    $stats = get_sitestats();
    $tmp_user_count = number_format ($stats[ 'users' ] );
    $tmp_blog_count = number_format ($stats[ 'blogs' ] );
    print "<strong>" . $tmp_blog_count . " Sites" . "</strong>";
    <?php } } ?>

    Any idea how to edit that?

    Incidentally, it is for a WPMU site and displays the current number of blogs on the network.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor M66B


    Try replacing

    if($multi_site_on == "true"){


    if (is_multisite()) {

    I’m not sure that is the problem, the errors I keep getting when I test it revolved around “unexpected brackets, $ends, or < signs. Basically, syntax errors based on the needs of the plugin itself. The code works, but just doesn’t seem to input into the plugin very well.

    Plugin Contributor M66B


    The <?php at the begin and ?> at the end should be removed probably …

    did that, but there is also a bunch of them in the middle that cause problems, took those out too and then I started getting “unexpected }” errors.

    I’m hoping that somebody with php knowledge and the plugin can drop this snippet into theirs and test it.

    Plugin Contributor M66B


    This is in any case syntactically correct:

    if ($multi_site_on == "true") {
    if (function_exists('get_sitestats')) {
    echo '<div class="site-stats"><span>';
    _e("Currently powering",TEMPLATE_DOMAIN);
    $stats = get_sitestats();
    $tmp_user_count = number_format($stats['users']);
    $tmp_blog_count = number_format($stats['blogs']);
    echo '' . $tmp_blog_count . ' Sites' . '';
    echo '</span></div>';

    But not tested functionally.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Shortcode Exec PHP] Need help adapting a snippet to work with plugin’ is closed to new replies.