Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('the_title', 'custom_the_title');
- function custom_the_title($title){
- global $page_id, $post;
- // Do not apply this filter if the post is not in the_loop
- // --- this excludes nav menus
- if( !in_the_loop() )
- return $title;
- if ($page_id)
- {
- $custom_title = get_post_meta($page_id, "custom_title", true);
- } else {
- $custom_title = get_post_meta($post->ID, "custom_title", true);
- }
- // Check if there is a metadata for title
- if ($custom_title)
- {
- // Do stuff here....
- }
- return $title;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement