0

I am trying to learn how to create a theme for wordpress so i looked at the default theme 'twenty sixteen'. I was crawling around it and searching everything that i find strange then i saw this code in " wp-content\themes\twentysixteen\inc\template-tags.php "file

function twentysixteen_the_custom_logo() {
if ( function_exists( 'the_custom_logo' ) ) {
    the_custom_logo();
}
}

and then we have this on header.php file

<?php twentysixteen_the_custom_logo(); ?> 

so i'm a bit confused here i tried to look it up on google but there was nothing helpful

first of all why he did not use the_custom_logo() method itself in the header file and second what is the use of the_custom_logo() method anyway ? what can we add to this method ?

references I searched my problem developer.wordpress.org and a bunch of other sites

btw, I'm newbie at both html and wordpress , I know how to code with php though

and if u know a good source for creating a theme for wp I will appreciate your sharing <3

(sorry for bad English )

0

first of all why he did not use the_custom_logo() method itself in the header file

This function checks that the the_custom_logo function exists for backwards compatibility, so that the function works on WordPress versions older than 4.5.

The reason this is done in inside twentysixteen_the_custom_logo() is so the theme can just use a single function in the template, without adding that if statement:

<?php twentysixteen_the_custom_logo(); ?>

vs

<?php
if ( function_exists( 'the_custom_logo' ) ) {
    the_custom_logo();
}
?>

and second what is the use of the_custom_logo() method anyway ? what can we add to this method ?

Themes can support a Custom Logo feature. This function outputs the selected logo.

and if u know a good source for creating a theme for wp I will appreciate your sharing <3

You should start with the theme handbook: https://developer.wordpress.org/themes/ But I would advise learning some basic HTML, CSS and PHP first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.