WordPress.org

Ready to get started?Download WordPress

Forums

Weird Question: Move widget Title to AFTER content. (2 posts)

  1. Will D. White
    Member
    Posted 2 years ago #

    Hey Guys,

    I was looking at a way of using the standard WP text widget to display testimonials on a site I'm working on. I was thinking how nice it might be to have my client add the name of the person giving the testimonial in the "Title" area and what they said in the text field.

    Since WP splits the title and content up, I can format them separately easily using CSS. However the only issue I'm concerned about is the fact that the name would display before the testimonial. Thats not ideal. I'd like the name of the person who gave the testimonial to display below the text widget contents.

    I know I can edit widgets.php and hack it - but that means I have to keep doing that any time I update WP in the future.

    Are there any hack-free ways (via functions.php preferably) that I can have a text widget title display AFTER the content of the text widget?

  2. David Gwyer
    Member
    Posted 2 years ago #

    The title, and content order of the text widget is fixed in the text widget class definition.

    However, there is nothing stopping you from copying the text widget class, renaming it (and the constructor), and adding it to your themes functions.php file (or a Plugin if you wish).

    Then, you can change the output of the title to be wherever you want. The text widget class definition can be found in the '/wp-includes/default-widgets.php' file on line 363.

Topic Closed

This topic has been closed to new replies.

About this Topic