• Hi,

    I am new in word press.

    I have created widget from admin side and i want to execute following php
    code from widget

    <?php
    echo"hello";
    ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter hiko

    (@hiko)

    Hi,

    I have downloaded php code plugin

    when i create new widget and use code

    <?
    echo"hello";
    ?>

    it is giving following message

    echo "hello";
    ?>

    Consider downloading and installing Otto’s PHP Code Widget.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    It has to start with <?php, not <?. Short forms are not supported.

    Hi, I also (think) I just want to execute a little bit of php code within a widget, and your widget seemed like the perfect thing.

    I’m trying to make a very simple thing, essentially a post counter saying “Now with 400 posts.” Your plugin in combination with the wp_count_posts function seemed to be the perfect thing. I installed the plugin, added the Widget to the appropriate sidebar, and pasted the following in after my plain text-

    <?php
    $count_posts = wp_count_posts();
    ?>

    I thought that code would then return a number of posts, but it just leaves a blank space. I freely admit to being a relative novice, and feel like I’m missing something pretty obvious. Any help would be great. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Excute php code from widget’ is closed to new replies.