• How do I add a title to a text widget using php?

    I’m trying to add php code to a text widget so that the title will reflect what page I am on. I have php code for the content which works.

    The problem is that the code for the title in the text widget is stripped away when I save the sidebar.

Viewing 6 replies - 1 through 6 (of 6 total)
  • AFAIK, php won’t work in a text widget. html and java will.

    Thread Starter ronbme

    (@ronbme)

    It will if you have the Exec-PHP plugin installed.

    I’ve got the php code working in the content section of the text widget. I have another plugin, “Page Sidebars”, which lets me add a sidebar for any page with content specific to that page.

    Then I just add the php code for the title and the php code for the content and it reads whatever I have typed specific for a certain page.

    The content part works fine but the title is being stripped. I think the title is being “sanitized” when I save the text widget, and that strips away my php code for the title.

    I need a way to save that php code for the title so it doesn’t get stripped.

    I suppose I could also come up with something to eliminate the title from the text widget and then recreate the title in the content part.

    Yes, apparently your php does not work for titles.

    I didn’t like the titles on my sidebar and I wanted them all to match so I did just what you are thinking about – made them part of the content. I know that is the lazy way out but it was all I could think of at the time.

    Thread Starter ronbme

    (@ronbme)

    Thanks. Can you explain how you did yours?

    BTW, not in my current blog but one I have stopped posting to . . .

    I used one text widget and put titles in like this <span class="newsheader2"><strong>From the video section</strong></span><br />
    then my java script or html
    then the next title, etc.

    Thread Starter ronbme

    (@ronbme)

    Thanks.

    I’ll have to play around with it. I am using the theme’s title box and am having trouble getting the title inside of the box.

    But, I’m close to solving it.

    Thanks again.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Adding Title in Text Widget’ is closed to new replies.