Custom User Interface Messages
A request we often get is the ability to customize user interface messages such as “Reply”, “Previous/Next Post”, and others. Weaver Xtreme now provides the ability to do this using standard WordPress filters. This section will list all the available filters to modify User Interface messages.
Note that some values, such as the “Continue Reading” message already have a built-in option due to popular demand. These messages can be changed either with a filter, or using the option.
These filters can’t be added directly by Weaver Xtreme, but are easily added using the new Weaver Xtreme <HEAD> Section Actions and Filters option provided by the Weaver Xtreme Plus plugin.
For example, to replace the built in Older/Newer Blog Navigation messages, add these filters to the Actions and Filters box:
/* Add filters to change the Older Blog Navigation messages */ add_filter('weaverx_older_posts','wx_older_posts'); function wx_older_posts($older) { return 'Back!'; }
The original message, including wrapping HTML for many strings, will be passed in to the filter using the single parameter. You can return whatever string you want, including your own HTML wrapping and styling. You have total flexibility in what message comes out. You would define similar filters for any of the following defined Weaver Xtreme filters.
Filters labeled with (%s) mean that the subject of the title (mostly archive page titles) will be used in place of the %s. If you want the extra title info, then you need to include the %s in your filter replacement. Technically, the title uses sprintf to add the specific information to the main title. For example, the tag archive default title is “Tag Archives: %s”. The tag name will be filled in to the %s position – “Tag Archives: Post Formats”.
If you don’t know PHP programming, join the crowd! But it isn’t that hard to simply use the above example to create your own custom message text for the various elements described in the list below. For example, suppose you want to change the text on the “Post Comment” button for comments. It is a pretty easy 4 step process – you can repeat for any of the filters listed below changing to appropriate names.
- Copy the above example into the Actions and Filters box.
- Change the ‘weaverx_older_posts’ to ‘weaverx_post_comment_form’.
- Change the ‘wx_older_posts’ to ‘wx_post_comment_form’.
- Finally, change the ‘Back!’ to whatever you want.
User interface message filters supported
- ‘weaverx_older_posts’, ‘weaverx_newer_posts’ – replace the Older/Newer and Previous/Next Blog Navigation Style for navigating blog posts.
- ‘weaverx_more_message’ – the Continue Reading message (already has built-in option)
- ‘weaverx_tag_archives’ – page title for tag archives (%s)
- ‘weaverx_404_title’ – page title for 404 page
- ‘weaverx_yearly_archives’, ‘weaverx_monthly_archives’, ‘weaverx_daily_archives’ – archive page title (%s)
- ‘weaverx_author_archives’ – Author Archive page title (%s)
- ‘weaverx_category_archives’ – Category Archives page title (%s)
- ‘weaverx_search_results’ – Search results page title (%s)
- ‘weaverx_comments_title’ – Title of comments section
- ‘weaverx_newer_comments’, ‘weaverx_older_comments’ – Older/Newer comments links
- ‘weaverx_leave_reply_blog’ – Leave a reply (blog page version)
- ‘weaverx_reply_1′ – Original: ”<b>1</b> Reply’ (blog page version)
- ‘weaverx_reply_many’ – Original ‘<b>%</b> Replies’ (% replaced by number of replies) (blog page version)
- ‘weaverx_leave_reply_form’ – Leave a Reply message on comment form
- ‘weaverx_cancel_reply_form’ – Cancel Reply message on comment form
- ‘weaverx_post_comment_form’ – Post Comment button on comment form
- ‘weaverx_site_title’ – The site title
- ‘weaverx_tagline’ – Site tagline
The strings associated with the Post top and bottom Meta information lines are not suitable for this type of filtering due to some technical limitations. The Weaver Xtreme Plus plugin provides the Custom Post Info Lines option to create custom wording and layout for these lines.