This works fine for me when i test it. I did edit your code as you had a small error in the function name not matching.
Also, you might want to add a conditional tag and wrap the shortcode in a div but otherwise it works.
function adt_abovetitle($title){
//Return new title if called inside loop
if ( in_the_loop() && is_singular('post') ) {
$x = do_shortcode('[shortcode id="'. $id . '"]');
return $x . $title;
} else {
//Else return regular
return $title;
}
}
add_filter( 'the_title', 'adt_abovetitle');
You might want to test your else statement as well.
Related Posts:
- Testing for post title in ‘if/else’ statement returns no content
- Stop WordPress Wrapping Images In A “P” Tag
- How to get ‘post_content’ without stripping tags?
- How to change the case of all post titles to “Title Case”
- Apply the_title() filter in post & page title, but not in menu title
- Get content from one page and show it on another page
- Removing any and all inline styles from the_content()
- Remove post title input from edit page
- Set Post Title to Read-only and Disable Permalink Slug Editor in Gutenberg
- How to disable content pagination?
- Modify ‘Read more’ link adding a new class
- Disallow Same Post Title
- Get title of post without using the_title();
- Verify if tag is used on posts
- Adding a div class or id inside the_content()
- Dynamically update post title in admin page
- Divide Post content into separate divs for every 500 characters (or any other character counts)
- How to show posts rank based on custom field value
- Post content being duplicated by the_content();
- Displaying Page Title on index.php
- How can I extract the URL of a link from a post?
- Content editor creating blank paragraphs in spaces and creating   in the_excerpt
- How to add custom content (text/image) at start of content (IN content ie the same line)
- How to intercept Post Title on Post-Save
- get_post_field – Title without paragraph
- Display the Content of a Post with qTip2
- How to show video from specific category on sidebar?
- Add Category name to Post Title (h1)
- How to add a custom field after wp post
- custom post type grid with content in lightbox [closed]
- Sorting posts alphabetical that have single digits
- How Can i Get 5 Recent Post Title With Corresponding Link?
- I want to show category in the post title , how can I do
- How to prevent WordPress from updating the modified time?
- How to display following posts titles in separate div’s on a separate webpage
- Blog Posts not showing title
- Lose “Blog Archive” from page title
- Uppercase first sentence in every post
- Why content_arr[‘extended’] removes paragraph tags?
- How to Orderby Comments by post title?
- Modify Image Source With The_Content Filter?
- How to add pagination in between post and comments?
- WordPress not opening posts with only numbers if permalink is post_name
- Adding the_date inside tags around the_content
- Show the content that is after the excerpt using child theme
- get query() without post content?
- How to show full post?
- sql select for post_title and a term name
- WordPress is replacing double minus signs in Post Title, how to disable it?
- Filter only the text in the_content
- How do I change the core post search algorithm? Where is it found/constructed?
- Is there a way to specify an extra class for a post or page with no title?
- How to check if single.php has already called the_post_thumbnail function
- Add title for previous and next posts to Yoko Theme
- Images inside post title
- Loop doesn’t show title of second post and posts thereafter
- How To capitalize The First Letter Of Every Word In The Post Title
- How to show show the Second page title in the page
- How to get links to the last N posts in a specific category?
- Create a list of posts with topic headdings
- How to disable the_excerpt from one post
- Blog post not showing title
- How can I remove the first two words and shorten get_the_title()
- How do I include the category next to the title of a post?
- How to style archive post titles… but only those posts who have comments?
- Replace image name on upload to the new post name on front-end form
- Edit the post title from the frontend
- Why in my query is display two title?
- Image behind the post’s title
- Change Post Title For Specific Category
- Add div before the first paragraph the_content [closed]
- the_content() Not Grabbing All Content
- How to remove “» (title of post or page)”?
- Auto update post title and slug when post status is changed
- Get featured image on hover of post title [closed]
- Microformats in a single post – layout conflict
- How do I display the post_title with get_permalink?
- Post titles and thumbnails as links to custom post types?
- If post exists, make it a comment in existing post with same name?
- Adding if statement into the_content()
- Changing The Default Header POST Title and Description text by category in wordpress
- Change modified date to current date when title updated automatically
- How to select a category automatically based on a word in WordPress post title?
- why my urdu text is not aligned properly when written in wordpress blog post?
- How do I display main query posts in random order using add_filter
- how to show current date on post title which should be auto update in every day
- How to exclude native lazy loading from first image in post content?
- Adding Text after Post Title based on Category using IF Condition – But not for menu items
- How to merge the content of posts that have the same title?
- How to limit wordpress the_excerpt() dynamically
- how can i take wordpress post as embed?
- Post title not displaying as recorded in the wp_posts table
- Create/Set Category as Title of Post
- long-title posts do not want published
- Please I want to prefix my WP posts title according to each category
- Add id attribute to h1 element of wordpress post
- Post title spoiler how?
- Odd hyphen added at end of blog post
- My posts page is missing the page title
- Hiding title of selected post without plugins