Custom WP plugin help wanted

I’m having some problems creating a custom wordpress plugin that allows me to display if I’m available or away for a certain period in the sidebar.

Now I’ve got the menu to show up in the Admin Panel and I got the datepicker to function. Now here is where I could use some help. I should mention I’m no expert coder by any stretch of the imagination so some more detailed help would be kind 🙂

Read More

I have 2 options, A is a radio button with a fixed value and B is a combination of 2 user inputs (I’m not available from X until Y) Where X and Y are the dates selected in the date fields. I would like to display either option A or B depending on the form and be able to change this if needed.

I’m not sure if I’m going at this the right way and any help would be greatly appreciated.

Regards,

S.J.

Here are my files:

afwezigplugin.php
http://pastebin.com/REbkvQzr

opties.php
http://pastebin.com/McHkmcsN

**The include (I think I need?)

$aanwezig = $_POST['groep'];
$van = $_POST['datevan'];
$tot = $_POST['datetot'];

    if ($aanwezig == "geen-afwezigheid") {
        echo 'Geen afwezigheid';
    }

    else {
                echo "Afwezig van ". $van . " tot en met " . $tot . ".";
    }
?>

Related posts

Leave a Reply

2 comments

  1. Do you mean you need to switch between to possible value inputs ? either the “A” radio button is clicked and in this case, the 2 “B” fields don’t matter or else the “A” radio button is not clicked and then the 2 “B” fields should be used? If so, use JavaScript to dynamically hide and reset value of the B fields when A is checked and dynamically show B fields when A is unchecked…
    If I understood what you are asking… which I am not sure

  2. OK, use something like this :

       $("#geenafwezig").click(function() {
        if($('#geenafwezig').is(':checked')) 
        {
                $('#geenafwezig').attr('checked','checked');
                $('#data').show();
    
        }
        else
        {
                $('#geenafwezig').removeAttr('checked','checked');
                $('#data').hide();
    
        }   
       });
    
        $(function () {
                $('#data').hide();
        });