WordPress.org

Support

Support » Plugins and Hacks » [Resolved] PHP code not supported in the widget title

[Resolved] PHP code not supported in the widget title

  • Hi, I’m trying to add PHP code in the widget title, but when I press save, the PHP code is removed.

    For example the widget title that I want to use is:
    More from <?php $category = get_the_category(); echo $category[0]->cat_name; ?>

    But when I hit Save, the title becomes:
    More from

    Is there any trick for allowing this to work?

    Thanks for your help.

    http://wordpress.org/extend/plugins/php-code-widget/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    You do have to be an admin and/or have the unfiltered_html capability on the site. Otherwise it’ll get filtered like everything else.

    Plugin Author Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    Oh, I just saw that you are trying to put code in the TITLE. Missed that.

    Yes, the PHP Code Widget does not support PHP Code in the title.

    I know this is an old thread, but any way this plugin will support PHP code in the future? I decided to place <?php echo 'test'; ?> in the title and the entire site failed to load O.o luckily I was able to remove the widget entry from the backend and the site loaded. Scared me for a sec!

    nilanjanb

    @nilanjanb

    the way I have done this – leave the title blank
    write code in the widget to display whatever you want

    Works for me 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] PHP code not supported in the widget title’ is closed to new replies.