You can use the wp_title
filter to modify the output of the wp_title
function.
quick example based on the example from Codex:
add_filter( 'wp_title', 'wpa66574_title_filter', 10, 3 );
function wpa66574_title_filter( $title, $sep, $seplocation ) {
// account for $seplocation
$left_sep = ( $seplocation != 'right' ? ' ' . $sep . ' ' : '' );
$right_sep = ( $seplocation != 'right' ? '' : ' ' . $sep . ' ' );
$page_type="";
// get special page type (if any)
if( is_category( 'videos' ) ) $page_type = $left_sep . 'Archive' . $right_sep;
// get the page number
if( get_query_var( 'paged' ) ) $page_num = $left_sep. get_query_var( 'paged' ) . $right_sep; // on index
elseif( get_query_var( 'page' ) ) $page_num = $left_sep . get_query_var( 'page' ) . $right_sep; // on single
else $page_num = '';
// concoct and return title
return $page_type . $title . $page_num;
}
Related Posts:
- Disable plugin / plugin action via theme
- Shared functionality in plugins and themes
- Need to create a Theme demo site that features multiple themes
- Declare a function before plugin does on the theme functions.php file
- Override the core function locate_template
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- All sites themes functions.php have been changed
- Proper way to use plugin functions in functions.php
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Removing the custom_image_header from wp_head
- What is the most efficient way of adding additional functionaliy for admin only
- Hide Plugin Custom Post Type Menu Link
- Securing langugae folder
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- Shows warning when enable “wp_gallery_custom_links” plugin with Themify Builder
- How can I add a custom checkbox / radio button on the admin theme options to display a CSS or other?
- How to Call Function From Separate WordPress Install on Same Server?
- pluggable function in theme, to be overridden by plugin
- Can’t get custom user meta to show in header
- Best collection of code for your 'functions.php' file [closed]
- Tips for using WordPress as a CMS? [closed]
- What Are Security Best Practices for WordPress Plugins and Themes? [closed]
- How to include a plugin’s php file to another plugin functions file [duplicate]
- How to get the active theme’s slug?
- if plugin is active? check if plugin is enabled or not?
- Disable author pages for specific users
- How to override a theme function (within a class) using a plugin
- Seeking clarification on page request life-cycle
- How to assign user a role if none is present when logging in
- How to remove action from plugin?
- Migrating a File from Plugin to Theme and changing its path → instead create a REST endpoint
- How to find out what blocks are added by a plugin
- Translating plugin inside the theme [closed]
- How to prevent users to download videos from lms website?
- Dropdown menu on custom page with product to choose number of products per page
- Different UI in WordPress
- How to append to title via functions.php for auto-posting plugin [duplicate]
- Bootstrap Drop Down menu is not working
- Custom random quote widget breaks when used in multiple sidebars
- Hooking in to replace the Sidebar/Widget areas
- How to change constants in WordPress wp-config.php programmatically?
- Child Pages Short Code plug-in and hover capabilities?
- How to call WordPress function other files
- Why namespaces are rarely used in WordPress plugins?
- How to create an option page for this simple plugin
- What is @Action in WordPress?
- the_tags : can we insert a class
- Where are theme codes located for WordPress?
- How to activate a plugin on the activation of a theme?
- WordPress plugin won’t show on some themes
- Send email with list of active plugins upon activation/deactivation
- How do I add a plugin dependency to my customized theme?
- Using custom fields for image alt and title
- Where Should i write the code for wordpress ajax voting?
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- How do I convert my WordPress website to be domain agnostic?
- Add action to custom Function
- Show media-uploads to all users
- Help with a function in a widget
- Cannot add edit themes and add plugins after multisite update
- Remove updates text on plugin or themes list page
- How do I create pages within a WordPress post?
- How to prevent plugin, theme installation failures on WordPress?
- WP Function does not trigger on Webhook API Call
- Alternative Hook to the_content for Changing Background Color
- Unpublished Pages Failing To Appear On Custom Path
- Post source link plugin – small modification
- Remove a div class with condition
- How Can I Increase Breadcrumb Position Count (Starting From 2)?
- Main content of site not showing, but does show when logged in to wp-admin
- How to add specific script to WordPress webpage that will working with user input and databases
- Hooking into the HTML header container
- Block plugin update possibilities (but not by hiding notifications)
- Execute function activate/deactivate plugin in specific pages
- Plugin function in child theme
- Unable to activate themes on localhost
- Soflyy WP All Import Custom File Download Issue
- why my wordpress dont have toolbar like, plugin, themes and other?
- How to link file or image from wordpress plugin dir to theme by using themes function.php, is it possible?
- Why isn’t my plugin seeing other classes?
- How to add submenu to WordPress plugin in the same Directory of main Plugin?
- Creating themes using the one Plugin (Toolkit)
- Template from scratch: Sidebars not showing widget
- Contact Form 7: custom validation [closed]
- functions.php conditional output for a single plugin
- Single dash converted to double dash
- Site is setup statically – how to make it content managable?
- How to declare this function correctly?
- Javascript as Jquery Function Call?
- How to escape html code?
- Elementor with system colors instead of kit colors [closed]
- How to disable plugin capability : “create new category”
- Option value not getting updated until page refresh in WordPress
- How to create an Info Box on WordPress [closed]
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- How to make content as required in custom post type?
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- Any plugin installation and update overwrite current theme
- Problem on a wordpress website with a plugin [closed]