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

  • Home
  • SEARCH
  • 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 5951441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:32:14+00:00 2026-05-22T17:32:14+00:00

I need a conditional statement to sit inside my WORDPRESS LOOP that reads as

  • 0

I need a conditional statement to sit inside my WORDPRESS LOOP that reads as follows – this is just an example of what I need, I do not have enough knowledge of PHP to structure this properly:

It should read:

if the_author_meta('client_id') = 'custom-value-1' then display the following code
       <div><img src="http://www.mywebsite.com/<?php echo get_post_meta($post->ID, 'img-id', true) ?>"/></div>
else display nothing

The client_id is stored in the_author_meta, so the function needs to check the value of client_id in the_author_meta and check if it matches the value I enter e.g. “custom-value-1”. If it matches, then it would display the div code, and if not, it would display nothing.

Can someone show me how to structure this into a proper PHP string please? I am still learning PHP so this will be a big help in my understanding : – )

Zach

  • 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-05-22T17:32:15+00:00Added an answer on May 22, 2026 at 5:32 pm

    This should do it.

    <?php 
    $client_id = get_the_author_meta('client_id');
    if ($client_id == 'custom-value-1') { ?>
        <div><img src="http://www.mywebsite.com/<?php echo get_post_meta($post->ID, 'img-id', true) ?>" /></div>
    <?php } ?>
    

    See here for comparison operators

    • Comparison
      Operators
    • Control
      Structures
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a conditional statement that I need some help with the syntax: if
I have a conditional statement that I need to add a redirect depending on
Have been searching for this, I need to have a conditional statement in my
I need to write a conditional statement that would check if L tab is
I use C#, I have a conditional statement in my code. I need to
This is one of those rare occasions that I have had to use conditional
I need to write a conditional statement in my where clause that uses different
HI, I need to write multiple statements inside a conditional operator. What will be
I need a conditional compilation switch that knows if I am compiling for the
I need some help adding conditions to a linq query. Take this small example

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.