Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Home Page title in Wordpress

Tags:

wordpress

I want to show home page title in breadcrumb. I have tried the get_the_title() function, but it requires page id as parameter. I believe it will break when I change the front page to other page. Is there a function that is more change prone?

like image 831
kdebugging Avatar asked Nov 29 '25 00:11

kdebugging


2 Answers

this is how I solved my problem

$home_title = get_the_title( get_option('page_on_front') );

that way, when I change home page with diferent page, the code won't break. It also works on multisite.

like image 198
kdebugging Avatar answered Nov 30 '25 14:11

kdebugging


Please try this..

<?php echo bloginfo('title'); ?>
like image 23
GS Bala Avatar answered Nov 30 '25 12:11

GS Bala



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!