New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Wordpress - php suggestion
Hello,
I am using wordpress with an adcode library bound in.
In my header.php I included this line:
<?php include('adcode.php'); ?>So what I would like to do is, to show these ads only to visitors. So logged in users (buddypress) should not get these .php file.
How would you do this?
Comments
Something like this?
Simply use is_user_logged_in() with if statement
so this could do the job?
Give it a try
Also remove php tags inside if statement
no chance, I see the code snippet in the header area
btw I am adding this code into the header.php of my theme. I think I should do it elsewhere
Theme functions file.
In the theme's
functions.php
:As mentioned above, you really should put more logic-related stuff in the theme's functions.php file and leave the template files for just printing content to the screen, basic loops, etc.
Exactly!
I was just too lazy to type that up on a mobile at 5am :P