WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] need help: popularity contest in sidebar (10 posts)

  1. agentsully
    Member
    Posted 7 years ago #

    I have the popularity contest plugin running on my site:

    http://lifelearningtoday.com

    I just tried to put it into the sidebar using an ExecPHP sidebar widget.

    This is the code I put into the widget:

    <?php akpc_most_popular($limit = 10, $before =
    <li>, $after = </li>
    ); ?>

    And this is the error I got:

    Parse error: syntax error, unexpected T_STRING in wp-content/plugins/widgets/execphp.php(24) : eval()'d code on line 1

    Can anyone lend assistance with correcting this? Thank you!

  2. agentsully
    Member
    Posted 7 years ago #

    oops, here's the code

    // <?php akpc_most_popular($limit = 10, $before =
    <li>, $after = </li>
    ); ?> //

    forgot to use backticks when putting in the code.

    thx.

  3. Chris_K
    Member
    Posted 7 years ago #

    I'm widget intolerant, so I've not used the execphp widget yet...

    but does it work better if you don't include the opening <?php and closing ?> tags?

  4. agentsully
    Member
    Posted 7 years ago #

    tried your suggestion but the execphp widget says that the code must be inside those tags.

    maybe Otto will pick up on this thread. I'll give him the link to this.

    I use windows not mac, if that has any significance.

    Thanks Handy. Like your new look on your site BTW.

  5. agentsully
    Member
    Posted 7 years ago #

    regarding the execphp widgets, my "Top Commentators" doesn't look too pretty and if it's not at the bottom, things get all messed up formatting wise.

    so it seems that the issue is with execphp...perhaps.

  6. Chris_K
    Member
    Posted 7 years ago #

    Thanks Handy. Like your new look on your site BTW.

    Thank you kindly.

    Regarding the original issue: Have you tried simplifying the function call a bit, just to ensure it isn't a parameter? Maybe something like:
    <?php akpc_most_popular($limit = 7); ?>
    ?

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Any error that it throws with "eval" in there means that the code you put into it is somehow wrong. There's nothing wrong with the ExecPHP widget, all it's really doing is running your code through an eval() statement. Other than that one minor difference, it's basically identical to the normal Text widgets.

    And yes, the <?php and ?> tags are required.

    In particular, this code:

    <?php akpc_most_popular($limit = 10, $before =
    <li>, $after = </li>
    ); ?>

    Doesn't make any sense at all. Perhaps you're actually wanting to do this?
    <?php akpc_most_popular(10, '<li>', '</li>'); ?>

  8. agentsully
    Member
    Posted 7 years ago #

    Otto, Thank you for responding here!

    Your fix is correct for the plugin to display. Thx!

    There is one other thing too. If you look at my site in IE you'll see on the left sidebar at the bottom, the Top Commentators leaks into the background color not the white sidebar that it is supposed to be in.

    Also if I move that widget to any other location it completely fouls up the formatting of the whole blog, like crazy. If it is not at the bottom things look a mess. If it is at the bottom over on the right hand column everything becomes centered (the posts and all widgets).

    That's why I don't have the Popular Posts in there yet, because it breaks my formatting to do so.

    Any suggestions? I am deeply grateful in advance of your reply! Thx.

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    You need to edit that widget and add <ul> and </ul> around the function call that you're making. Why? Because the html it's creating has each link inside of an li tag, but you don't have a list around those for the li tags to make sense.

    Just edit the widget and change this:
    <?php your_function_call(); ?>

    to this:

    <ul>
    <?php your_function_call(); ?>
    </ul>
  10. agentsully
    Member
    Posted 7 years ago #

    Otto, You're a lifesaver! I know I probably look like a dummie, not knowing that already. But I'm learning. I thank you so much!!

    And thank you HandySolo for taking the time to help also!

Topic Closed

This topic has been closed to new replies.

About this Topic