Knowing that I can not make a IF statement
a variable, how would I make the statement globally accessible within a function? Would I use a ternary operator but if I do how do I make that globally accessible with the Global()
function?
project background: This is wordpress so in my functions file I am trying to place the if statement and then access on various other pages. I have a number of other variables in the global scope already so the set up is there between the pages etc, I am just not sure how to globally access the if statement
My If statement I am trying to make accessible from multiple pages is
if($total_result > 0 && $endResult->posted_by == 'customer'){
echo '<i class="fas fa-comments-dollar"></i> <br> Client requested a reduced price. <br> They asked for $' . $endResult->price_quote;
}else if($endResult->posted_by == 'dc_vendor'){
echo "Waiting for Client response" . '<br>' . '<i class="fas fa-hourglass-half"></i>';
}else{
echo "Please check availability and respond to client with availability and price";
}
UPDATE 1 IDEA:
function vendor_dash_client_response_action($total_result,$end_result) {
global $vendor_dash_client_response_action ;
if($total_result > 0 && $endResult->posted_by == 'customer'){
echo '<i class="fas fa-comments-dollar"></i> <br> Client requested a reduced price. <br> They asked for $' . $endResult->price_quote;
}else if($endResult->posted_by == 'dc_vendor'){
echo "Waiting for Client response" . '<br>' . '<i class="fas fa-hourglass-half"></i>';
}else{
echo "Please check availability and respond to client with availability and price";
}
};
add_action( 'after_setup_theme', 'vendor_dash_client_response_action' );