The $instance['title']
corresponds to the title enter in the widget.
When a plugin or a widget as an apply_filters, the developper gently had a way to override the current value sets for the title.
Now, imagine you setted a title (in the widget setting panel) but you want to change this value only if user is logged in. You just have to add a filter in your functions.php
add_filter('widget_title', 'logged_title');
function logged_title($title){
if(is_user_logged_in()){ // don't forget to test your widget id
$title="new widget title";
}
return $title;
}
Related Posts:
- Limit number of Widgets in Sidebars
- check if registered sidebar is active & has widget content
- Adding iframe Content to Sidebar Widget
- How to use wp_dequeue_style() for style enqueued in WP_Widget class
- $post>ID displays wrong post ID
- Programmatically edit the text of a widget
- Video Embed in Sidebar Widget with Links to Others in Category
- Shortcode from a widget is wrapped in unwanted element
- Bookshelf plugin and/or widget [closed]
- How to update widget from widget() function?
- Create a Widget Area in the Navigation Bar for the Genesis Theme Framework?
- Add a banner to the Dashboard
- How to access widget data from outside widget?
- Unable to get Alert function to consistently work with backend widget with latest WP
- Widget options get
- add_page_menu to make shortcut to widgets
- Insert custom content before widget title/after widget opening tag
- Custom Menus, Widgets & Conditional Statements
- Dynamic widgets
- How do I stop a widget from displaying on mobile site?
- cannot drag and drop widgets since wordpress 3.2.1
- Show widget when not using SSL
- How/where is the global variable $wp_registered_widgets filled?
- Converting a WordPress widget to a block
- Change recent posts widget title
- How can I use AJAX to save/update a widget form?
- Display assigned terms with link
- Hide all Dashboard Widgets (not remove)
- Making footer widgets responsive
- Form link throwing website to main language
- Is there a way to extend the default image widget into a new custom widget and add additional fields to it?
- Create widget in dashboard displaying a custom user field?
- Widget without DIV wrapper
- Widgets not displaying since 4.3
- Custom widget with WYSIWYG
- Limit number of widgets in widget area
- How to update the widget form when the image is selected?
- How can I add an author-box below a post?
- Override WordPress Widget CSS Classes?
- displaying tags in a widget
- Dynamic Sidebar and XHTML Validity?
- Displaying a WordPress widget by name
- Adding a WordPress Widget to a settings page
- Display posts from category in post content?
- How to change “Call To +1800090098” in TopStore pro theme [closed]
- How to dynamically add the the input text field in widget?
- Header Sidebar Won’t Move Lower – Want to Align with Header Logo [closed]
- Enabled checkbox by default in WordPress widgets
- Is there a way to use get_sidebar() when no widgets are activated?
- Is there any tab widget plugin supporting third party widgets? [closed]
- Add footer widgets
- Widgets in WP 4.3 disappearing – How to fix?
- Making jQuery .change() event persistent after widget save
- Widget background images missing on second blog excerpt page
- Custom CSS for a particular text/html widget in WordPress
- Removing side bar widgets from GovPress theme
- What conditional to use for dynamic sidebar check?
- Adding a single text input field to a custom Dashboard widget
- how to show only particular category post in archive widgets
- How to test if the widgetized area has any widgets?
- Saving widget gets an undefined variable
- Trouble accessing a multidimensional array to add classes to default WordPress widgets
- Distinguish between different widgets of the same type
- links to Media Library content in sidebar per page
- Why is registering a sidebar for each page causing my sidebars to reset?
- Limit archive widget results
- How can I detemine the parameters needed by the_widget()?
- widgets in footer?
- Can you hide a widget based on its content?
- Quick Draft widget in weird place on dashboard after being re-added
- Fatal error: Uncaught Error: Class ‘WP_Widget’ not found
- Array showing all values of loop instead of specific value to post
- How can I remove WordPress element IDs and Class names in the HTML?
- Remove widgets on mobile front page without affecting desktop
- Widget not appearing in customizer
- Widget display nothing
- Widget settings disappear after refresh
- How to display author meta in a sidebar widget
- Is it ok not to set widget in the main page of a one page WordPress Theme?
- How to get widget content in WordPress based on it’s ID?
- Recent Posts Widget URL / Domain change
- New Custom Widget Call a Different Widget Function
- Make a widget to my footer
- How to change text of a widget depend on condition?
- Display Posts by Views (Popular Posts Widget)
- Default WordPress widgets always appear
- Add space to the end on a widget
- Show editor widgets only on pages that use a specific template?
- Options page for widget
- user definable sidebar per page
- List.js inside WordPress widget
- Show or hide custom menu widget in side bar conditionally
- Custom tabs widget don’t work in google chrome, is blocked, do not change the tabs. Why?
- WordPress Hide Widget If $_Session Is Active?
- Post Thumbnails on Sidebar Widgets
- Widget which displays thumbnails, but links to urls?
- Using Conditional Tags to restrict something to 1 user?
- Problem on register/login widgets
- Classic widgets with 5.9+?
- Custom dashboard widget – load style only for added widget