Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

This function will return the title of a post for a given post ID.

0
votes
1answer
26 views

How to show users search phrase in SEO Title

How to create dynamic SEO titles? If users search phrase should be shown in the SEO Title in the google search. Ex: If a user searches "Meat delivery in Hyderabad" title in google search should be ...
0
votes
0answers
15 views

Save & Share Cart for WooCommerce cart title use in cart page

I'm using save and share cart in woocommerce site and I create a page to load all saved carts title since plugin creates a posttype and I load each saved cart using same url plugin used in a email ...
0
votes
1answer
126 views

How come I get internal server error even with try catch for get_the_title in functions.php?

I'm relatively new to PHP & wordpress but not to programming. I wanted to have a title relative to the $post title, so I created the following filter and added it to functions.php: add_filter('...
0
votes
1answer
36 views

How do I hide the current page's title?

I have this code: add_filter( 'the_title', function() { return ""; }); Or, respecting the hook's arguments: function remove_title( $title, $id ) { $title = ''; return $title; } ...
0
votes
0answers
35 views

Display title of custom post type dynamically

I've registered my custom post type in functions.php like so: function whatwedo_custom_post_type() { register_post_type('whatwedo', array( '...
0
votes
1answer
15 views

How to place POST TITLE any location inside the posts page

I am editing the single.php file, and I want post title to appear inside a particular div. Since my theme doesnt show the post title, I want to retrieve the post title on posted article page. " > &...
-2
votes
1answer
44 views

How to store wordpress title in a variable

trying to run a PHP youtube v3 data in a WordPress theme $grab=ngegrab('https://www.googleapis.com/youtube/v3/search?key='.$devkey.'&part=snippet&order=relevance&maxResults=5&q='.$...
0
votes
1answer
257 views

change title separator

tell me how permanent the links to change the splitter from vertical to horizontal of the main page write website. | — http://joxi.ru/a2XlxQXcyeKPj2 The name of the site | short name The name of the ...
-1
votes
1answer
81 views

Why this Read More Not working in Php?

Only that Read More issue is remaining. <?php while(have_posts()): the_post(); echo '<h2>'.get_the_title().'</h2>'; echo get_the_post_thumbnail(...
0
votes
2answers
245 views

How to change the page title from functions.php

I have an ACF custom field that depends on the value I need to change the page title, however, I cannot affect the page title, it appears my code is running after the page title is generated. To ...
0
votes
4answers
127 views

Adding Filter | Page Title | Template | Why the_title affecting on menu?

I've added a template in my theme, I want to change page title using following code. but its change my menu titles also. I'm unable to fix this issue. Please help. function get_id_by_slug($page_slug) ...
0
votes
0answers
35 views

insert page Title into Sections

Sure this has been covered a million times before but just need help with editing a function.php part to a child theme on wordpress. So on the front end of a page we have "Description" This is ...
0
votes
1answer
58 views

Print title page in header of a specific page

I'm trying to customize Avada template. I want to print in the header the page title, but only for specific pages. So I tried in header.php <head> <?php if ( page_is('80') ) { echo ...
1
vote
1answer
48 views

how i can add title to my featured image?

I want to add a title to my featured image, how I can add this item: $attr = array( 'title' => 'howdy partner', 'alt' => 'a nice view of the ocean', ); // pick one, note 2 or 3 ...
-2
votes
1answer
23 views

echo spesific title get_the_title

I have two title QCM Rare I want to show the title into table header foreach($quiz_ids as $quiz_id){ echo '<th><a href="'.get_permalink($quiz_id).'" target="_blank"> '.get_the_title(...
1
vote
1answer
84 views

How to sanitize post title with commas

I need to sanitize WordPress title with commas that is using commas to replace the spaces. i used this but didn't worked for me echo sanitize_title_with_commas("the_title"); What i mean is: if ...
1
vote
1answer
64 views

Access get_the_title() from 'excerpt_length' filter

Is there a way to access the get_the_title() function from a excerpt_length filter? For example, setting the excerpt length to be the same as the title: function excerpt_length_same_as_title( $...
-1
votes
2answers
58 views

Wordpress loop put title into variable

I am trying to get the permalink and title into variables to use outside of a loop - I have made it work for the thumbnail but for some reason can t get it to work for these two. Here is my code: &...
0
votes
1answer
39 views

Use title of post as argument for query

I want to use the title of the actual post as argument parameter for a wp_query. I already tried to set it with the_title or get_the_title() but it does not work. Is it possible to save the title as ...
1
vote
1answer
35 views

Custom post type title is set by other custom post type

Im trying to make a small plugin that can produce a team with a trainer. The team is a Custom Post Type and the trainer is a Custom Post Type. When I create a new team, i read all the trainers in a ...
0
votes
1answer
155 views

the_title() is not displaying over the_thumbnail

With the static html/css title that i have inside h1, is displaying over image, but when i use the_post_thumbnail(); with the_title();. Title moves above the image What may be the issue? <div ...
1
vote
1answer
30 views

Long Post Title Misaligning Grid with Featured Image

I'm putting together a grid with the featured images as the background and the post title above. It works fine, but when the post title spreads over two lines the entry before or after is moved up/...
-1
votes
2answers
38 views

Bug with post titles [closed]

My post titles are displaying the title of the media (image) rather than the title of the post. WP V4.8 using postgrid for posts; deactivated this, issue still occurs deactivated current theme; ...
0
votes
1answer
45 views

Customise the_title in admin area

Experienced in PHP but new to WordPress, so excuse me if I'm not calling things the right things. Basically my set up is that I want the pages to be called one thing in the admin area for ease of ...
0
votes
1answer
2k views

How to add dynamic content in title and meta description in wordpress theme for homepage, post page, category, tag and pages

I am creating wordpress theme and want to get and display dynamic content for my theme Title Tag and Meta Description Tag. For Title Tag Content: I want Title For Meta Description: I want Bloginfo('...
0
votes
2answers
738 views

get_title without filter(the_title)

I'm using a function to filter the_title, adding a string onto the end, but would also like to return the original title, unfiltered on the same page. Is there a way to get the title without it being ...
0
votes
1answer
58 views

Get title from IDs in a string

Im trying to get titles from IDs in string, but I'm getting stucked when I want to use get_the_title() function and receving error implode(): Invalid arguments passed $act_name = explode(',', $...
5
votes
2answers
4k views

Changing title of a page dynamically from within a plugin

Every WordPress page can be described as having two titles: The page/post title, which is displayed within the page/post via the the_title() function call The html <title></title> tag ...
1
vote
1answer
795 views

get_posts() loop returns the same the_title() for each post

I'm using get_posts() to fetch posts from a particular category to display at the top of my homepage, separate from the main homepage Loop. Everything seems to work fine, but for the title (returned ...
0
votes
1answer
299 views

Modifying recent post widget to include icons for post titles

I have downloaded a plugin from the wordpress repository which allows adding font icons to the titles of posts, you can select a different icon for individual posts according to preference. Now, the ...
1
vote
2answers
33 views

Display post content with respect to its title?

I am building a custom loop where I want to display post content only if its title matches a specific string. But I am out of luck on getting this done right. Here is my code so far. $args = array(...
0
votes
2answers
1k views

Filter get_the_title to remove certain characters?

I know that WordPress can filter shortcodes like the_content but is it possible to filter get_the_content? I have a function that is able to use substr and strpos and I know it works on the_title. I ...
0
votes
3answers
145 views

WordPress Load Only Page Text

I'm working on a page template and I need the_title to be separate from the page text. I'm not sure how to load the_content without it having the title. Can anyone help?
-1
votes
1answer
64 views

Rename file after title , one small problem

I'm using this question: Change Attachment Filename which works but it has a problem. He renames every file with FileNameToRename and it's same image. What I want to do is instead of FileNameToRename ...
0
votes
2answers
553 views

Change post title if post has specific category

Basically what I am trying to achieve is to have title changed of posts which are in category number 30. My code is: function adddd($title) { if(has_category('30',$post->ID)){ $title = 'Prefix '....
0
votes
1answer
98 views

Wordpress title as keywords (tags) with excluded stop words

How to change normal sentence WordPress title to "tag like" list with excluded "stop words". Example: "This is one test post title about something." To: "one, test, post, title, something" This ...
5
votes
2answers
8k views

Is there any difference between the_title() and echo get_the_title()?

Just a small question. Is there any difference in using <?php the_title() ?> or <?= get_the_title() ?> Yeah, I know somebody can consider using short echo tag a bad practice, I just ...
0
votes
4answers
465 views

How to output the title of the blogs home page

I am using a static frontpage and a page for my blogposts. In my header.php I want to display the title of the selected page of my blogposts. For example: <?php if( is_home() ) echo '<h1>'...
1
vote
1answer
640 views

the_title filter returning wrong post type

I am using the the_title filter to attempt to prepend some text to a custom post type's title. Our website has several custom post types. Product - slug is eproduct Brand - slug is brand-listing ...
0
votes
2answers
247 views

Shorten the title length

So I'm using this filter in order to shorten the title: function the_titlesmall($before = '', $after = '', $echo = true, $length = false) { $title = get_the_title(); if ( $length && ...
0
votes
1answer
2k views

Replace text in the Title

In a string displayed by <?php the_title(); ?> I have to replace all & characters with and. Here is the code I've tried without success: <?php $wptitle = the_title(); $wptitle = ...
0
votes
1answer
616 views

Safe way to get the post ID in the_title()

Is there a safe way to get the post ID inside the_title()? add_filter('the_title', "change_post_title"); function change_post_title($title){ } I tried using global $post and get_the_ID(), but this ...
1
vote
1answer
6k views

WP action/filter to modify title before header output and article output?

I'm trying to split test two versions of a posts title using a custom plugin. So far I haven't found the right filter or action to hook into to modify the title on the meta tag level before the page ...
0
votes
1answer
979 views

Wrong post title displayed from loop

I'm building my own theme. I have a page set for my blog (with a template that I made) which I'd like to just display a few of my posts. It uses the following loop: <?php query_posts('post_type=...
-1
votes
3answers
1k views

Show page name in browser

I am developing my first WP theme and would like to know how to display page name for every page/post instead of just "mysiteaddress.com" How can I set that all my posts and pages show the tittle by ...
0
votes
1answer
1k views

the_title not working

I'm using the_title() to show the title of a custom post type, but it's not working; the title does not show. get_header(); $wp_query = new WP_Query(); $wp_query -> query('post_type=press&...
-1
votes
1answer
5k views

Enter a variable in the 'category_name' parameter

Is it possible to use a variable for the 'category_name' parameter? I have three pages: red, yellow, and blue. I have multiple posts that are categorized in three categories: red, yellow, and blue. ...
0
votes
1answer
75 views

Show post title words one by one [closed]

How to show post title words one by one, but to exclude words with 3 or less characters. Also it would be nice to be able to exclude some words, for example to make some list of words to exclude from ...
-1
votes
2answers
373 views

Title displaying multiple times

I'm facing a problem where my title is being displayed multiple times. Using the following code the page title 'News' is displayed 10 times, the same number as the number of posts I've elected to ...
0
votes
4answers
1k views

Get post/page title from ID

I'm trying to get the post title of a post_type (post/page/portfolio) in the admin panel outside of the loop. I nearly tried all possible solutions, but without success: //method 1 $content_post = ...