codexpower Posted February 22, 2015 Share Posted February 22, 2015 i am a beginner and learning wordpress. Codex is not for beginners the information there is in the form of notes, something that is very difficult to be grasped for any beginner. I have few question, This is from header.php - <!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo('charset'); ?>"> <meta name="viewport" content="width=device-width"> <title><?php bloginfo('name'); ?></title> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <div class="container"> <!-- site-header --> <header class="site-header"> <h1><a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a></h1> <h5><?php bloginfo('description'); ?></h5> </header><!-- /site-header --> Why is this part used twice - <?php bloginfo('name'); ?> First in head section - <title><?php bloginfo('name'); ?></title> then in Body - <h1><a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a></h1> Quote Link to comment https://forums.phpfreaks.com/topic/294821-basic-word-pres-syntax-help-needed/ Share on other sites More sharing options...
cyberRobot Posted February 23, 2015 Share Posted February 23, 2015 Why is this part used twice - <?php bloginfo('name'); ?> The bloginfo() function prints the result directly to the screen. So it needs to be called every time you want that value. However, you could assign the value to a variable by using get_bloginfo(). Then just use the variable wherever you want. More information can be found here: http://codex.wordpress.org/Function_Reference/get_bloginfo Quote Link to comment https://forums.phpfreaks.com/topic/294821-basic-word-pres-syntax-help-needed/#findComment-1506506 Share on other sites More sharing options...
QuickOldCar Posted February 24, 2015 Share Posted February 24, 2015 The first one is the title of the document which is a hidden element of the page to a visiting user and used by browsers and search engines <title><?php bloginfo('name'); ?></title> The other one in body they are using as the title of your blogs home href link which is visible. This is way of automating the creation of your home link <h1><a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a></h1> Quote Link to comment https://forums.phpfreaks.com/topic/294821-basic-word-pres-syntax-help-needed/#findComment-1506569 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.