0

I try to Remove CPT template(single-proucts.php) Content with Custom Meta Box. I created a Input select option for change content in my CPT metabox it's working then update post I need to change content CPT template(single-proucts.php). I have no idea What i do. Admin switch to 'page2' post inside cpt template change content. Any Help Greatly Appreciated.

session_start();
if (isset($_POST['dataoption'])) {
    $zonoption = $_POST['dataoption'];
    $_SESSION['dataoption'] = $zonoption ;
} else {
    $zonoption  = $_SESSION['dataoption'];
} ?>
      <select name="dataoption" onchange="this.form.submit()">
            <option value="page1"<?php if ($zonoption  == "page1") { echo " selected"; } ?>>1</option>
            <option value="page2"<?php if ($zonoption  == "page2") { echo " selected"; } ?>>2</option>
        </select>
    </form>

<?php
switch ($dataoption) {
    case 'page2':
        echo 2;
        break;
    case 'page1':
        echo 1;
        break;
}
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.