Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a wordpress site with more than 70 pages of different brand car offers. Each page has a custom field named Price with a numeric value.

This is what I got so far:

function setup_modificari_pret() {
add_menu_page(
    'Modificari pret', 'Madificari Pret', 'manage_options',
    'modificari-pret', 'setari_modificari_pret');
}
add_action("admin_menu", "setup_modificari_pret");


function setari_modificari_pret() {
?>
<div class="wrap">
    <?php screen_icon('themes'); ?> <h2>Modificari de pret</h2>
    <form method="POST" action="">
        <table class="form-table">
            <tr valign="top">
                <th scope="row">
                    <label for="modifica_pret">
                        Valoare numerica:
                    </label>
                </th>
                <td>
                        <input type="text" name="modifica_pret" value="<?php echo $pret_modificat;?>" size="5" /> %
                    </td>
            </tr>
        </table>
    </form>
</div>

<p>
    <input type="submit" value="Save" class="button-primary"/>
</p>

<?php
}

if (isset($_POST["update_settings"])) {
$pret_modificat = esc_attr($_POST["pret_modificat"]);  
update_option("nume_tema", $pret_modificat);
$pret_modificat = get_option("nume_tema");
}

I want to add an option page settings to update all the prices from the database with the possibility to increase or decrease them with 10%. How can I achieve this ?

share|improve this question
1  
Achieve what, specifically? Where does this fail? Do you want to change prices in the database or change them on display? –  s_ha_dum Feb 18 at 15:12
    
Change them in the database –  noctis Feb 18 at 16:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.