Please put below code in your functions.php file. You will need to create custom field named ‘custom_post_name’ and set the custom field text to what you want to add to page title.
function alter_page_title(){
global $post;
$current_page_title = $post->post_title;
/* Check if lower case version of current page title is = online exams. */
if (strtolower($current_page_title) == "online exams"){
/* If yes then get value of custom_post_name meta field and add that to beginning of title & return */
$custom_title_to_append = get_post_meta($post->ID, custom_post_name, true);
return $custom_title_to_append. " ".$current_page_title;
} else {
/* else return title as is */
return $post->post_title;
}
}
add_action('the_title', 'alter_page_title');
Related Posts:
- Archive permalinks
- Permalinks for WooCommerce Categories and Subcategories
- Rewrite url / permalink for default archive – yearly / monthly
- Change of permalink structure – redirects in htaccess breaks the archive links
- Custom permalink for search and pagination
- Programatically changing post’s permalink when identical post type is published
- Date Archives’ Permalinks under Category folder
- Can’t select blog month within archive category
- Advanced author permalinks
- Disable date based archives for all categories except one
- Path to Pages Resolves to Archive instead of Actual Content
- permalinks issue and archives
- Change permalink structure for pagination only
- Strip subcategory base from URL
- archive by year and category: permalink support doesn’t work on pagination
- Customize URL for specific tags archive
- Permalinks – Archives
- WordPress Archives Cause Looping
- Permalink, links a page to the homepage
- Permalinks of archive tag wordpress
- WordPress archive posts returns user to homepage
- Post archive pages bringing me to a 404 page
- Strip category base from URL?
- where is permalink info stored in database?
- How can I reverse engineer a Permalink to Find the Page?
- Mapping Domains to Permalinks (not multisite)
- How to remove dates from existing permalinks?
- WordPress Permalink changes to question mark (?) in URL
- Force WordPress to Show Pages Instead of Category
- How would I create a different permalink structure for pages and posts?
- My permalinks are broken! Can I use mod_rewrite to ignore a physical file?
- Can WordPress realistically handle a site with 500 ‘pages’?
- How to prevent the default home rewrite to a static page
- Is there an action for when permalinks are rebuilt?
- How to get url of a post from admin panel
- How to get a page url by a page id?
- CPT archive 404ing when using a custom taxonomy name as a variable
- How to change “permalink” structure in “WordPress Thesis” theme?
- Performance and styles not working fine after changing permalink structure
- Maintaining two permalink structures
- removing index.php IIS 7.5 webconfig
- Permalinks Messed up
- rewrite_rule for custom post type doesn’t affect get_permalink
- Add ‘articles’ prefix before blog posts url without affecting pagination
- 404 Page Not Found for Only One Post
- How to 301 all posts
- WordPress within specific sub-directories, implicitly not root
- Custom attachment permalink structure [closed]
- Call to a member function add_rule() on a non-object
- Link to blog index from template
- How to change Post ID during import
- Is there anything built into the WordPress core to enable me to get the relative path from the “permalink structure” option
- Permalink change made author archive vanished
- WordPress 404 in development area
- Custom Permalink
- Pagination Issue – /page/2 404
- How to stop WordPress from removing & from URL?
- Nginx Rewrite Rule:: index.html added to every permalink
- Share same Slug for a Custom Post Type and 2 Taxonomies
- Redirect a Blogger Page URL to wordpress
- How to prevent redirect when using the term “page” in query string?
- Edit page slug after save, cause 404 by linked pages
- Return value of get_permalink(0) and get_the_title(0)
- Custom function making troubles in get_permalink for ACF relationship fields
- .htaccess rewriterule being ignored – tyring to remove dates from WP posts
- How to redirect RSS feeds to Feedburner and keep pretty permalinks?
- Apply function only if end of url has /amp/ [closed]
- Assigning proper permalink to blog that is part of a website
- What would cause a 500 Server Error with permalinks turned OFF?
- Changing permalinks back to default ( ?p=123 )
- permalinks on title tag
- How to redirect old permalinks from https://exmaple.com/category/post_id to https://exmaple.com/category/post_id.html
- Double Slash After Media Path (uploads//)
- New posts link to old posts (random)
- Is it possible to set public to false for the native WordPress blog
- Custom Permalink (with category) for Pages
- 301 redirects after changing permalinks
- Post links broken after migration
- How to change permalink for listings
- Link works although page was moved to another location
- wordpress admin panel loop on nginx
- WordPress All pages but home simply read “hello”
- How to change link of an uploaded file to the media library
- On Macbook, my permalinks with post name don’t work. Returning 404 error
- WordPress pages break with custom permalink settings (theme directory not output)
- Remove /index.php from Permalink
- Difference and usage of uri (e.g. get_directory_uri) and absolute path (e.g. get_directory)
- Fresh wordpress installation in sub-directory not accessible
- Get link from wpe_excerpt “read more” and move it
- WordPress 4.0 beta – how to change the link URL in RSS feeds
- Folder Name and Category Name WordPress
- How to display post permalinks instead of pages?
- Search points to /search/?s=KEYWORD instead of /search/KEYWORD
- How to change pagination base from slash to query form?
- WP Custom Permalink Filter
- standard post with extra parameter brings permalink problem
- Siteurl code for links
- Redirect Loops Problems
- Permalinks get lost periodically
- Stymied by 500.5 error for WordPress on IIS 8 / Windows Server 2012