[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

add in php code to functions.php page

Posted on 2011-09-06
11
Medium Priority
?
385 Views
Last Modified: 2012-05-12
Hi there.  I need to add the following code to the script below (where that TD is located).

if ( is_user_logged_in() ) {
    <TD><a href=\'/join\' title=\'Join MembersMix.com!\'><img src=\'/images/logo/top-right2.png\' border=\'0\' width=\'340\' height=\'40\'></a></TD>
} else {
    <TD><a href=\'/join\' title=\'Join MembersMix.com!\'><img src=\'/images/logo/top-right.png\' border=\'0\' width=\'340\' height=\'40\'></a></TD>
}

Any ideas experts?
functions.php file...

<?php
//customize header
remove_action('genesis_header', 'genesis_do_header');
add_action('genesis_header', 'child_do_header');
function child_do_header() { 
echo '<style type=\'text/css\'>
.headertext_b {
color: #FFFFFF;
font-weight: bold;
font-style: italic;
font-size: 16px;
font-family: Arial, Tahoma, Verdana;
text-shadow: #002838 1px 1px;
}
table.header_bkg {
border-spacing:0;
padding: 0;
color: #FFFFFF;
}
.inputtext {
width: 128px;
height: 18px;
text-align: left;
margin: 0;
border: 0px;
background:#fff;
}
.formsubmit {
width: 46px;
height: 20px;
cursor:pointer;
margin: 0;
border: 0;
}
td.bkg {
background: url(\'/images/logo/bottom-right.png\') no-repeat left top;
border-spacing:0;
padding: 0;
color: #FFFFFF;
height: 110px;
width: 340px;
}
</style>
</head>
<body>
<TABLE border=\'0\' cellpadding=\'0\' cellspacing=\'0\' align=\'center\'>
<tbody>
<form name=\'loginform\' id=\'loginform\' action=\'wp-login.php\' method=\'post\'>
<input type=\'hidden\' name=\'testcookie\' value=\'1\' />
<TR>
<TD rowspan=2><a href=\'/\' title=\'Members Mix\'><img src=\'/images/logo/left.png\' border=\'0\' width=\'620\' height=\'150\'></a></TD>
<TD><a href=\'/join\' title=\'Join MembersMix.com!\'><img src=\'/images/logo/top-right.png\' border=\'0\' width=\'340\' height=\'40\'></a></TD>
</TR>
<TR>
<TD class=\'bkg\'>
	<TABLE border=\'0\' cellpadding=\'0\' cellspacing=\'0\' align=\'left\'>
	<tbody>
	<TR>
	<TD><div style=\'padding-top:42px;\'><input type=\'text\' name=\'log\' id=\'user_login\' class=\'inputtext\' value=\'\' tabindex=\'1\' /></div></TD>
	<TD><img src=\'/images/spacer.gif\' border=\'0\' width=\'15\'></TD>
	<TD><div style=\'padding-top:65px;padding-bottom:10px;\'><input type=\'password\' name=\'pwd\' id=\'user_pass\' class=\'inputtext\' value=\'\' tabindex=\'2\' /></div><a href=\'wp-login.php?action=lostpassword\' title=\'forgot your password? click here\'><img src=\'/images/spacer.gif\' border=\'0\' width=\'130\' height=\'16\'></a></TD>
	<TD><div style=\'padding-top:42px;\'><input type=\'submit\' value=\'Log In\' name=\'wp-submit\' tabindex=\'3\' id=\'1\' /></div></TD>
	</TR>
	<tbody>
	</TABLE>
</TD>
</tr>
</form>
</TABLE>';
}
%>

Open in new window

0
Comment
Question by:COwebmaster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 36490507
Not sure what your question is...
0
 

Accepted Solution

by:
COwebmaster earned 0 total points
ID: 36490562
If I add in that code into the script, but the graphics don't look right so I must be doing something wrong. I have it like this:
//customize header
remove_action('genesis_header', 'genesis_do_header');
add_action('genesis_header', 'child_do_header');
function child_do_header() { 
echo '<style type=\'text/css\'>
.headertext_b {
color: #FFFFFF;
font-weight: bold;
font-style: italic;
font-size: 16px;
font-family: Arial, Tahoma, Verdana;
text-shadow: #002838 1px 1px;
}
table.header_bkg {
border-spacing:0;
padding: 0;
color: #FFFFFF;
}
.inputtext {
width: 128px;
height: 18px;
text-align: left;
margin: 0;
border: 0px;
background:#fff;
}
.formsubmit {
width: 46px;
height: 20px;
cursor:pointer;
margin: 0;
border: 0;
}
td.bkg {
background: url(\'/images/logo/bottom-right.png\') no-repeat left top;
border-spacing:0;
padding: 0;
color: #FFFFFF;
height: 110px;
width: 340px;
}
</style>
</head>
<body>
<TABLE border=\'0\' cellpadding=\'0\' cellspacing=\'0\' align=\'center\'>
<tbody>
<form name=\'loginform\' id=\'loginform\' action=\'wp-login.php\' method=\'post\'>
<input type=\'hidden\' name=\'testcookie\' value=\'1\' />
<TR>
<TD rowspan=2><a href=\'/\' title=\'Members Mix\'><img src=\'/images/logo/left.png\' border=\'0\' width=\'620\' height=\'150\'></a></TD>
if ( is_user_logged_in() ) {
    <TD><a href=\'/join\' title=\'Join MembersMix.com!\'><img src=\'/images/logo/top-right2.png\' border=\'0\' width=\'340\' height=\'40\'></a></TD>
} else {
    <TD><a href=\'/join\' title=\'Join MembersMix.com!\'><img src=\'/images/logo/top-right.png\' border=\'0\' width=\'340\' height=\'40\'></a></TD>
}
</TR>
<TR>
<TD class=\'bkg\'>
	<TABLE border=\'0\' cellpadding=\'0\' cellspacing=\'0\' align=\'left\'>
	<tbody>
	<TR>
	<TD><div style=\'padding-top:42px;\'><input type=\'text\' name=\'log\' id=\'user_login\' class=\'inputtext\' value=\'\' tabindex=\'1\' /></div></TD>
	<TD><img src=\'/images/spacer.gif\' border=\'0\' width=\'15\'></TD>
	<TD><div style=\'padding-top:65px;padding-bottom:10px;\'><input type=\'password\' name=\'pwd\' id=\'user_pass\' class=\'inputtext\' value=\'\' tabindex=\'2\' /></div><a href=\'wp-login.php?action=lostpassword\' title=\'forgot your password? click here\'><img src=\'/images/spacer.gif\' border=\'0\' width=\'130\' height=\'16\'></a></TD>
	<TD><div style=\'padding-top:42px;\'><input type=\'submit\' value=\'Log In\' name=\'wp-submit\' tabindex=\'3\' id=\'1\' /></div></TD>
	</TR>
	<tbody>
	</TABLE>
</TD>
</tr>
</form>
</TABLE>';
}

Open in new window

0
 
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 36490675
There were no php tags
//customize header
remove_action('genesis_header', 'genesis_do_header');
add_action('genesis_header', 'child_do_header');
function child_do_header() { 
echo '<style type=\'text/css\'>
.headertext_b {
color: #FFFFFF;
font-weight: bold;
font-style: italic;
font-size: 16px;
font-family: Arial, Tahoma, Verdana;
text-shadow: #002838 1px 1px;
}
table.header_bkg {
border-spacing:0;
padding: 0;
color: #FFFFFF;
}
.inputtext {
width: 128px;
height: 18px;
text-align: left;
margin: 0;
border: 0px;
background:#fff;
}
.formsubmit {
width: 46px;
height: 20px;
cursor:pointer;
margin: 0;
border: 0;
}
td.bkg {
background: url(\'/images/logo/bottom-right.png\') no-repeat left top;
border-spacing:0;
padding: 0;
color: #FFFFFF;
height: 110px;
width: 340px;
}
</style>
</head>
<body>
<TABLE border=\'0\' cellpadding=\'0\' cellspacing=\'0\' align=\'center\'>
<tbody>
<form name=\'loginform\' id=\'loginform\' action=\'wp-login.php\' method=\'post\'>
<input type=\'hidden\' name=\'testcookie\' value=\'1\' />
<TR>
<TD rowspan=2><a href=\'/\' title=\'Members Mix\'><img src=\'/images/logo/left.png\' border=\'0\' width=\'620\' height=\'150\'></a></TD>
<?php
if ( is_user_logged_in() ) {
?>
    <TD><a href=\'/join\' title=\'Join MembersMix.com!\'><img src=\'/images/logo/top-right2.png\' border=\'0\' width=\'340\' height=\'40\'></a></TD>
<?php
} else {
?>
    <TD><a href=\'/join\' title=\'Join MembersMix.com!\'><img src=\'/images/logo/top-right.png\' border=\'0\' width=\'340\' height=\'40\'></a></TD>
<?php
}
?>
</TR>
<TR>
<TD class=\'bkg\'>
	<TABLE border=\'0\' cellpadding=\'0\' cellspacing=\'0\' align=\'left\'>
	<tbody>
	<TR>
	<TD><div style=\'padding-top:42px;\'><input type=\'text\' name=\'log\' id=\'user_login\' class=\'inputtext\' value=\'\' tabindex=\'1\' /></div></TD>
	<TD><img src=\'/images/spacer.gif\' border=\'0\' width=\'15\'></TD>
	<TD><div style=\'padding-top:65px;padding-bottom:10px;\'><input type=\'password\' name=\'pwd\' id=\'user_pass\' class=\'inputtext\' value=\'\' tabindex=\'2\' /></div><a href=\'wp-login.php?action=lostpassword\' title=\'forgot your password? click here\'><img src=\'/images/spacer.gif\' border=\'0\' width=\'130\' height=\'16\'></a></TD>
	<TD><div style=\'padding-top:42px;\'><input type=\'submit\' value=\'Log In\' name=\'wp-submit\' tabindex=\'3\' id=\'1\' /></div></TD>
	</TR>
	<tbody>
	</TABLE>
</TD>
</tr>
</form>
</TABLE>';
}

Open in new window

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:COwebmaster
ID: 36490743
okay, I tried that but it appears that both images get displayed
0
 
LVL 23

Expert Comment

by:jeremyjared74
ID: 36490782
If you're interested in learning how to use styles inside of your php, there is a very good theme that is meant to show people that want to learn to develop themes. The theme is named Oenology by Chip Bennett. It is very well documented and should give you a much better understanding or how it all works. Here is a link to his tutorial:
http://make.wordpress.org/themes/2011/01/05/themes-and-the-wp-settings-api/

If you just want to use it once and don't need to learn, just use some code provided by the experts here.
0
 
LVL 23

Expert Comment

by:jeremyjared74
ID: 36490830
0
 

Author Comment

by:COwebmaster
ID: 36491049
thanks jeremyjared74.  Unfortunately, I'm not familiar enough yet with php but still learning :)

So, any tips on why the following script adds both images into the table?

<?php
if ( is_user_logged_in() ) {
?>
    <TD><a href=\'/join\' title=\'Join MembersMix.com!\'><img src=\'/images/logo/top-right2.png\' border=\'0\' width=\'340\' height=\'40\'></a></TD>
<?php
} else {
?>
    <TD><a href=\'/join\' title=\'Join MembersMix.com!\'><img src=\'/images/logo/top-right.png\' border=\'0\' width=\'340\' height=\'40\'></a></TD>
<?php
}
?>
0
 

Author Comment

by:COwebmaster
ID: 36491386
nevermind, I figured it out on my own.
//customize header
remove_action('genesis_header', 'genesis_do_header');
add_action('genesis_header', 'child_do_header');
function child_do_header() { 
    
if ( is_user_logged_in() ) {
    echo '<style type=\'text/css\'>
.headertext_b {
color: #FFFFFF;
font-weight: bold;
font-style: italic;
font-size: 16px;
font-family: Arial, Tahoma, Verdana;
text-shadow: #002838 1px 1px;
}
table.header_bkg {
border-spacing:0;
padding: 0;
color: #FFFFFF;
}
.inputtext {
width: 128px;
height: 18px;
text-align: left;
margin: 0;
border: 0px;
background:#fff;
}
.formsubmit {
width: 46px;
height: 20px;
cursor:pointer;
margin: 0;
border: 0;
}
td.bkg {
background: url(\'/images/logo/bottom-right.png\') no-repeat left top;
border-spacing:0;
padding: 0;
color: #FFFFFF;
height: 110px;
width: 340px;
}
</style>
</head>
<body>
<TABLE border=\'0\' cellpadding=\'0\' cellspacing=\'0\' align=\'center\'>
<tbody>
<form name=\'loginform\' id=\'loginform\' action=\'wp-login.php\' method=\'post\'>
<input type=\'hidden\' name=\'testcookie\' value=\'1\' />
<TR>
<TD rowspan=2><a href=\'/\' title=\'Members Mix\'><img src=\'/images/logo/left.png\' border=\'0\' width=\'620\' height=\'150\'></a></TD>
<TD><a href=\'/join\' title=\'Logout\'><img src=\'/images/logo/top-right2.png\' border=\'0\' width=\'340\' height=\'40\'></a></TD>
</TR>
<TR>
<TD class=\'bkg\'>
	<TABLE border=\'0\' cellpadding=\'0\' cellspacing=\'0\' align=\'left\'>
	<tbody>
	<TR>
	<TD><div style=\'padding-top:42px;\'><input type=\'text\' name=\'log\' id=\'user_login\' class=\'inputtext\' value=\'\' tabindex=\'1\' /></div></TD>
	<TD><img src=\'/images/spacer.gif\' border=\'0\' width=\'15\'></TD>
	<TD><div style=\'padding-top:65px;padding-bottom:10px;\'><input type=\'password\' name=\'pwd\' id=\'user_pass\' class=\'inputtext\' value=\'\' tabindex=\'2\' /></div><a href=\'wp-login.php?action=lostpassword\' title=\'forgot your password? click here\'><img src=\'/images/spacer.gif\' border=\'0\' width=\'130\' height=\'16\'></a></TD>
	<TD><div style=\'padding-top:42px;\'><input type=\'submit\' value=\'Log In\' name=\'wp-submit\' tabindex=\'3\' id=\'1\' /></div></TD>
	</TR>
	<tbody>
	</TABLE>
</TD>
</tr>
</form>
</TABLE>';
} else {
    echo '<style type=\'text/css\'>
.headertext_b {
color: #FFFFFF;
font-weight: bold;
font-style: italic;
font-size: 16px;
font-family: Arial, Tahoma, Verdana;
text-shadow: #002838 1px 1px;
}
table.header_bkg {
border-spacing:0;
padding: 0;
color: #FFFFFF;
}
.inputtext {
width: 128px;
height: 18px;
text-align: left;
margin: 0;
border: 0px;
background:#fff;
}
.formsubmit {
width: 46px;
height: 20px;
cursor:pointer;
margin: 0;
border: 0;
}
td.bkg {
background: url(\'/images/logo/bottom-right.png\') no-repeat left top;
border-spacing:0;
padding: 0;
color: #FFFFFF;
height: 110px;
width: 340px;
}
</style>
</head>
<body>
<TABLE border=\'0\' cellpadding=\'0\' cellspacing=\'0\' align=\'center\'>
<tbody>
<form name=\'loginform\' id=\'loginform\' action=\'wp-login.php\' method=\'post\'>
<input type=\'hidden\' name=\'testcookie\' value=\'1\' />
<TR>
<TD rowspan=2><a href=\'/\' title=\'Members Mix\'><img src=\'/images/logo/left.png\' border=\'0\' width=\'620\' height=\'150\'></a></TD>
<TD><a href=\'/join\' title=\'Join MembersMix.com!\'><img src=\'/images/logo/top-right.png\' border=\'0\' width=\'340\' height=\'40\'></a></TD>
</TR>
<TR>
<TD class=\'bkg\'>
	<TABLE border=\'0\' cellpadding=\'0\' cellspacing=\'0\' align=\'left\'>
	<tbody>
	<TR>
	<TD><div style=\'padding-top:42px;\'><input type=\'text\' name=\'log\' id=\'user_login\' class=\'inputtext\' value=\'\' tabindex=\'1\' /></div></TD>
	<TD><img src=\'/images/spacer.gif\' border=\'0\' width=\'15\'></TD>
	<TD><div style=\'padding-top:65px;padding-bottom:10px;\'><input type=\'password\' name=\'pwd\' id=\'user_pass\' class=\'inputtext\' value=\'\' tabindex=\'2\' /></div><a href=\'wp-login.php?action=lostpassword\' title=\'forgot your password? click here\'><img src=\'/images/spacer.gif\' border=\'0\' width=\'130\' height=\'16\'></a></TD>
	<TD><div style=\'padding-top:42px;\'><input type=\'submit\' value=\'Log In\' name=\'wp-submit\' tabindex=\'3\' id=\'1\' /></div></TD>
	</TR>
	<tbody>
	</TABLE>
</TD>
</tr>
</form>
</TABLE>';
}
}

Open in new window

0
 

Author Closing Comment

by:COwebmaster
ID: 36518412
mine version worked
0
 
LVL 23

Expert Comment

by:jeremyjared74
ID: 36491885
I guess I didn't make it in time.

Here is a little bit of advice for you if your using php with WordPress, or any php site. It's best to use dynamic links when possible. For instance, with WordPress you can call for your images and link to text like this:
<a href="<?php echo get_permalink(1); ?>">join<img src="<?php bloginfo('template_url'); ?>/images/logo.jpg"/></a>

Open in new window

0
 

Author Comment

by:COwebmaster
ID: 36491903
Okay, thank you.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
This article discusses how to implement server side field validation and display customized error messages to the client.
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question