Soft reject, Help me please with this issue

wordpress

#1

Hi guys, this is my 100th soft reject, well, can you help me with this issue please? this is the review:

  1. Any item in header/footer area that is a function should be moved into functions file. Otherwise theme might have issues when users overrides with custom templates via child theme. Example(s) from your code and there are more: https://redpen.io/ja086ccacf288ec5ed

that is a piece of my header.php code, I am not defining functions in header.php. only I am calling it,
or maybe the reviewer is saying that I can´t call functions in header.php and footer.php?

can someone tell me what I need to do? it is in redpen

Thanks


#3

Can you post the full code from your header.php and footer.php?


#4

Hi, yes, I have upload my code as an image so anyone can put a comment in the part that I have to change, https://redpen.io/wq843b616c70d38f3b

Thanks,
if you want me to upload the code let me know, I dont know how to solve this issue


#5

Just make a function out of all the variables and if else statements( in your header.php) and add in functions.php and call that function in your header.
That will prevent your variables getting stuck just in parent header.php and will be more child theme friendly

Tell me if this solves your issue. All the best.


#6

I have received the following as soft reject points:

  1. Any item in header/footer area that is a function should be moved into
    functions file. Otherwise theme might have issues when users overrides
    with custom templates via child theme.

here is our header code

here is footer code

can you please or any one explain how we can fix this or point out what the comment does it mean


#7

I think what the person above you said is what you need to but whenever possible use hooks


#8

@Zorbix can you please explain more or any reference to that, please


#9

I think what they want is for all php code in your header page like the if statement to be in a function. and the function to be called from the header.php file.


#10

Thanks dear i got it now :slight_smile:


#11

Word of warning, you’re going to get pulled for the use of the Global variable the footer. They may not have mentioned it to you yet ( they seem to like to play these games of only telling you bits and pieces at a time ), but they will.


#12

Thanks dear for your input :wink: