0

I am not strong in code. I have this code to express a custom attribute:

$levtider = get_post_meta( get_the_ID(), '_product_attributes', true);
    $parts = $levtider["part-number"]["value"];
    if ($parts != "") {
    $content .= "Part numbers<br>" . $parts;
    }

The problem is that the name "part-number" sometimes is "model-number" or "parts-no".

Is it possible to make abstract the name to always use the first position array? I imagine something like:

$parts = $levtider[1]["value"];

Is this possible? My alternative is to rename them all, but I am looking for a centralized code solution.

prokops
  • 45
  • 6

0 Answers0