Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
There's code in my project that links a button in the navigation to a Twitter account. I'm trying to duplicate this for Facebook. I already made a Facebook .li style in the CSS. The new FB button appears next to the Twitter btn, but I can't get it to link. I also created a function to make an input field for Facebook.
PHP
<?php if (get_option(THEME_PREFIX . "twitter_link")) { ?>
<li class="twitter"><a href="http://twitter.com/<?pho echo get_option(THEME_PREFIX . "twitter_link"); ?>"title"Twitter"></a></li>
<?php if (get_option(THEME_PREFIX . "facebook_link")) { ?>
<li class="facebook"><a href="http://facebook.com/<?pho echo get_option(THEME_PREFIX . "facebook_link"); ?>"title"Facebook"></a></li>
I'd appreciate any help!
Posted
Updated 28-Sep-10 22:48pm
v2

There are quite obviously some syntax errors in your code, but I assume they are just mistakes. Are you sure a valid URL is being produced?
 
Share this answer
 
hello,

I didn't see where you close the first if statement. Seem like you have a nested if statement.

if (get_option(THEME_PREFIX . "twitter_link")) {
//twitter link

} --> try locate the closing bracket for the first if statement and append the new if statement below it.

if (get_option(THEME_PREFIX . "facebook_link")) {
//Facebook link


XML
<?php if (get_option(THEME_PREFIX . "twitter_link")) { ?>
<li class="twitter"><a href="http://twitter.com/<?pho echo get_option(THEME_PREFIX . "twitter_link"); ?>"title"Twitter"></a></li>
<?php } ?> //locate this
<?php if (get_option(THEME_PREFIX . "facebook_link")) { ?>
<li class="facebook"><a href="http://facebook.com/<?pho echo get_option(THEME_PREFIX . "facebook_link"); ?>"title"Facebook"></a></li>
<?php } ?

>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900