PHP Content Replacement for a front-end label on a search function

I’m currently building a used car listing platform using WordPress in conjunction with the Progression Car Dealer plugin and the WP All Import plugin. The basic premise being that my client provides me with an XML feed containing all of the vehicles they currently have. Each vehicle is then imported as a new listing into Progression Car Dealer using WP All Import.

The car dealer has several different branches and one of the search parameters must be a “Branch” checkbox. Unfortunately the system the client uses gives a dealer code rather than the dealer name.

So the code ends up looking like this:

<p class="field field-dealership fieldtype-radio">
<label title=""><b>Dealership: </b></label><br>
<label class="choice choice-1467"><input type="checkbox" name="dealership[]" value="1467" checked="checked">  1467 (57)</label><br>
<label class="choice choice-1468"><input type="checkbox" name="dealership[]" value="1468" checked="checked">  1468 (10)</label><br>
<label class="choice choice-1469"><input type="checkbox" name="dealership[]" value="1469" checked="checked">  1469 (76)</label><br>
<label class="choice choice-1460"><input type="checkbox" name="dealership[]" value="1470" checked="checked">  1470 (38)</label><br>

So for example, 1467 (57), 1467 is the dealer code for one of the branches. 57 being the amount of vehicles listed for that dealership. So obviously the choice-1467 and the value="1467" must remain unchanged, but 1467 (57) must be updated on the front-end to Tech 1 Nissan Cape Town (57) with the (57) again remaining unaffected.

The further challenge is, could this be done to affect the plugin from the functions.php file, I would prefer to leave the plugin as it is so that we can keep it updated without having to redo these changes.

I have absolutely no idea where to start or whether PHP or JavaScript would be best. Any help would be appreciated.

Thanks in advance

Read more here: PHP Content Replacement for a front-end label on a search function

Leave a Reply

Your email address will not be published. Required fields are marked *