Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9141337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:37:54+00:00 2026-06-17T09:37:54+00:00

I have a simple php script that I am using to display social icons

  • 0

I have a simple php script that I am using to display social icons if user has provided their social network username in the fields of their user account in wordpress.

Problem is that all of the network icons are being displayed even if the networks username was not provided.

I clearly understand the reason why it is happening since all of the divs are wrapped in the same echo output, but cannot really figure out how to use isset within that echo to output if condition of each div is met individually.

I hope that my explanation of the problem is not too confusing

Here is example of my script

    echo '
<div class="author_networks">
<div class="gplus"><a class="soc_btn gplus_img" href="https://plus.google.com/'. get_the_author_meta('google_plus', $authorID) .'" rel="me" target="_blank"></a></div>
<div class="facebook"><a class="soc_btn facebook_img" href="http://www.facebook.com/'. get_the_author_meta('facebook', $authorID) .'" target="_blank"></a></div>
<div class="twitter"><a class="soc_btn twitter_img" href="http://twitter.com/'. get_the_author_meta('twitter', $authorID) .'" target="_blank"></a></div>
<div class="linkedin"><a class="soc_btn linkedin_img" href="http://www.linkedin.com/company/'. get_the_author_meta('linkedin', $authorID) .'" target="_blank"></a></div>
</div>
</div>'

Thanks in advance for your suggestions

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:37:55+00:00Added an answer on June 17, 2026 at 9:37 am

    Sime IF statement will work:

    <?
    echo '<div class="author_networks">';
    if ($condition == 'gplus') {
        echo '<div class="gplus"><a class="soc_btn gplus_img" href="https://plus.google.com/' . get_the_author_meta('google_plus', $authorID) . '" rel="me" target="_blank"></a></div>';
    } elseif ($condition == 'facebook') {
        echo '<div class="facebook"><a class="soc_btn facebook_img" href="http://www.facebook.com/' . get_the_author_meta('facebook', $authorID) . '" target="_blank"></a></div>';
    } elseif ($condition == 'twitter') {
        echo '<div class="twitter"><a class="soc_btn twitter_img" href="http://twitter.com/' . get_the_author_meta('twitter', $authorID) . '" target="_blank"></a></div>';
    } elseif ($condition == 'linkedin') {
        echo '<div class="linkedin"><a class="soc_btn linkedin_img" href="http://www.linkedin.com/company/' . get_the_author_meta('linkedin', $authorID) . '" target="_blank"></a></div>';
    }
    echo '</div>';
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple script that creates a user: <?php include 'mysqlserver.php'; session_start();
I have a simple PHP script that will either serve up a streaming ASF
I have a simple php script on my domain that sends me an email:
I have a simple script of code that reads a PHP file and when
I have simple question. User supplies URL to my PHP script where I fetch
I have an AJAX request (using JQuery) that calls a PHP script which does
Here I have a simple php script which displays some values from a database
I have over 1000 clients and I developed a simple PHP script to loop
i have the following simple script <input class=input type=text name=password style=color: #797272; value= <?php
I have written a very very very simple!! script in php. header redirection not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.