Questions tagged [get-the-title]
This function will return the title of a post for a given post ID.
116 questions
0 votes
0 answers
16 views
WooCommerce uninstalled but 'My Account' prefix still showing on an existing page
We tested WooCommerce and decided not to use it. After uninstalling it I repurposed a test page (sample-page) to be used as a content page.. but the title shows 'My Account: Sample Page' even though ...
0 votes
1 answer
71 views
Website Title Not Showing in Browser Tab / Title Tag Empty in Page Source
I have set my WordPress' Website title and tagline in the settings, but it's not showing in any browser tab. It only shows the website URL in the tab. When I check the source code, the tag is blank I ...
0 votes
1 answer
105 views
How to edit specific title instead of all the title calls
I would like to add an html element right before the title of the blog posts. The code I'm using is as follows: function add_html_above_title($title, $post_id) { if (is_single() && $...
2 votes
1 answer
276 views
Display image title and caption on posts and pages
I want a simple function to display image titles and captions alongside each other below the images on wordpress posts and pages. All the answers I have seen do not work for me. Either they leave the ...
0 votes
1 answer
114 views
Auto Generate Post Title from 2 ACF Taxonomies [closed]
I am looking for a custom function to auto generate a post title/slug for a specific CPT from two taxonomies and one custom field, created with ACF Pro. Auto generation should be done only when the ...
0 votes
1 answer
55 views
Replace post title based on conditions
So I would like to replace the entire title of posts in WordPress bases on user behaviuor and role. Please note that I would like to replace the entire post title and not the prepend or append text to ...
0 votes
0 answers
197 views
How to ignore WP_ERROR caused by "get_the_excerpt" method in an AJAX call?
function get_post_data(){ $post_id = $_POST['post_id']; ... $data['title'] = get_the_title( $post_id ); ... $data['excerpt'] = get_the_excerpt( $post_id ); ... ...
0 votes
0 answers
249 views
Filter the title to only affect the_title() template function
I am using the_title filter to add an HTML snippet under the title, as follows: I only want the output to happen for the main title in the posts or page view. That's why I added an early return to ...
0 votes
1 answer
417 views
Shortcode Not Working in Slider When Added To Post Title
I've coded a shortcode to add manually to specific post title fields so i can style part of a title add_shortcode( 'green', 'green_shortcode' ); function green_shortcode( $atts, $content = 0 ) { $...
0 votes
0 answers
44 views
Display Most Recent Post Widget Title On Page
I want to display the Recent Posts Widget title on a page, however I could not find a solution yet. I dont want to display the recent posts on the page only the title of the most recent posts widget, ...
1 vote
0 answers
91 views
Don't see add_filter result in the site front page
I modified the site title the 'the_title' filter. I am using ACF pro repeater, I want to achieve is that if there is content in the repeater a + will be added to the post title. I wrote this script: ...
0 votes
1 answer
151 views
Trim Titles Only On Some Pages
I Need to Trim the h2.entry-title, including whitespace and special character Only On Homepage, Category Pages, and Tag Pages. (eg. Gowland Remote Control Car – RC Cars Xmas Gifts) I Need All Titles ...
0 votes
1 answer
350 views
Changing Title Tag on Shop Archive Page (current solution reverting to Title of First Product in Loop)
Firstly, add_theme_support( 'title-tag' ); is enabled in my theme. I have two filters to modify titles, this one hooking on to the_title add_filter( 'the_title', 'custom_account_endpoint_titles', 10, ...
0 votes
1 answer
2k views
Multilanguage website get the title, on different languages
I am working on a website, and I am using Polylang to translate it to a different language. In my code I want to get a page title, and display it. My issue is I cannot get it by ID or page_by_path ...
0 votes
1 answer
1k views
Modify WordPress Page Title (<head></head>)
I'm trying to modify the WordPress page title. However I'm fairly new to WordPress functions, hooks (filters & actions) and so on. What I could achieve is to change and modify WordPress titles in ...