$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>themes - Changing input type from text to multi select dropdown - skill taxonomy|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

themes - Changing input type from text to multi select dropdown - skill taxonomy

matteradmin9PV0评论

Really need help with a wordpress code please.

I have a field on a form which adds tags to the post. Problem is, its free for anyone to enter anything. This keep populating the "skill" taxonomy. The code for that is:

<div class="form-group skill-control">
<label><?php _e('Tags', 'themes');?></label>
<input type="text" class="form-control text-field skill" id="skill" placeholder="<?php _e("Enter tags", 'themes');?>" name=""  autocomplete="off" spellcheck="false" >
<ul class="skills-list" id="skills_list"></ul>
</div>

What I want is, it will instead have a dropdown multi select. The dropdown will get populated using the list in skills taxonomy. The code I have so far is:

<div class="input-group">
<label for="skill"><?php _e('Specialist Skills', 'themes');?></label>
<?php
ae_tax_dropdown('skill',
array('attr' => 'data-chosen-width="100%" data-chosen-disable-search="" multiple data-placeholder="' . __("Choose tags", 'themes') . '"',
'class' => 'chosen chosen-multi multi-tax-item required',
'hide_empty' => false,
'hierarchical' => true,
'id' => 'skill',
'show_option_all' => false,
)
);?>
</div>

At the moment, the code is working on the from, but not inserting the tags in the post! When I retrieve the post, there are no tags.

If I use the previous code, it adds the tags to the post.

Please help! What am I doing wrong?

Complete code:

if (isset($_GET['return_url'])) {
    $return = $_GET['return_url'];
} else {
    $return = home_url();
}
$currency_code = ae_currency_code(false);
?>
<div class="step-wrapper step-post" id="step-post">
    <form class="post-job  post et-form" id="">
        <div class="form-group clearfix">
            <div class="input-group">
                <label for="post_title" class="input-label"><?php _e('Let\'s name your request', 'themes');?></label>
                <input type="text" class="input-item input-full" name="post_title" value="" required>
            </div>
        </div>
        <div class="form-group row clearfix <?php echo ('1' == ae_get_option('custom_price_mode') || is_super_admin($user_ID)) ? 'has-price-field' : ''; ?>">
            <?php if ('1' == ae_get_option('custom_price_mode') || is_super_admin($user_ID)): ?>
                <?php


?>
                <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 clearfix">
                    <div class="input-group">

                        <label for="et_budget"><?php printf(__('Your budget (%s)', 'themes'), $currency_code);?></label>
                        <input type="number" name="et_budget"  class="input-item et_budget" >

                    </div>
                </div>
            <?php endif?>

            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 delivery-area">
                <div class="input-group delivery-time">
                    <label for="time_delivery"><?php _e('Max time for a specialist to deliver (Day)', 'themes');?></label>
                    <input type="number" name="time_delivery" value="" class="input-item time-delivery" min="0">
                </div>
            </div>
            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 category-area">
                <div class="input-group">
                    <label for="job_category"><?php _e('Category', 'themes');?></label>
                    <?php
                        ae_tax_dropdown('job_category',
                        array('attr' => 'data-chosen-width="100%" data-chosen-disable-search=""  data-placeholder="' . __("Choose categories", 'themes') . '"',
                            'class' => 'chosen chosen-single tax-item required',
                            'hide_empty' => false,
                            'hierarchical' => true,
                            'id' => 'job_category',
                            'show_option_all' => false,
                        )
                    );?>
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="input-group">
                <label class="mb-20"><?php _e('Description', 'themes')?></label>
                <?php wp_editor('', 'post_content', ae_editor_settings());?>
            </div>
        </div>

        <div class="input-group">
            <label for="skill"><?php _e('Preferred Specialist Skills', 'themes');?></label>
            <?php
                ae_tax_dropdown('skill',
                array('attr' => 'data-chosen-width="100%" data-chosen-disable-search="" multiple data-placeholder="' . __("Choose tags", 'themes') . '"',
                    'class' => 'chosen-multi multi-tax-item required',
                    'hide_empty' => false,
                    'hierarchical' => true,
                    'id' => 'skill',
                    'show_option_all' => false,
                )
            );?>
        </div>

        <div class="form-group skill-control">
            <label><?php _e('Tags', 'themes');?></label>
            <input type="text" class="form-control text-field skill" id="skill" placeholder="<?php _e("Enter microjob tags", 'themes');?>" name=""  autocomplete="off" spellcheck="false" >
            <ul class="skills-list" id="skills_list"></ul>
        </div>

        <div class="form-group">
            <button class="<?php mje_button_classes(array('btn-save', 'waves-effect', 'waves-light'))?>" type="submit"><?php _e('SAVE', 'themes');?></button>
            <a href="<?php echo $return; ?>" class="btn-discard"><?php _e('DISCARD', 'themes');?></a>
            <input type="hidden" class="input-item post-service_nonce" name="_wpnonce" value="<?php echo de_create_nonce('ae-job_post-sync'); ?>" />
            <input type="hidden" class="input-item is_submit_request" name="is_submit_request" value="1">
            <input type="hidden" class="input-item post_type" name="post_type" value="<?php echo JOB_RECRUIT;?>">
        </div>
    </form>
</div>

Thanks in advance.

Really need help with a wordpress code please.

I have a field on a form which adds tags to the post. Problem is, its free for anyone to enter anything. This keep populating the "skill" taxonomy. The code for that is:

<div class="form-group skill-control">
<label><?php _e('Tags', 'themes');?></label>
<input type="text" class="form-control text-field skill" id="skill" placeholder="<?php _e("Enter tags", 'themes');?>" name=""  autocomplete="off" spellcheck="false" >
<ul class="skills-list" id="skills_list"></ul>
</div>

What I want is, it will instead have a dropdown multi select. The dropdown will get populated using the list in skills taxonomy. The code I have so far is:

<div class="input-group">
<label for="skill"><?php _e('Specialist Skills', 'themes');?></label>
<?php
ae_tax_dropdown('skill',
array('attr' => 'data-chosen-width="100%" data-chosen-disable-search="" multiple data-placeholder="' . __("Choose tags", 'themes') . '"',
'class' => 'chosen chosen-multi multi-tax-item required',
'hide_empty' => false,
'hierarchical' => true,
'id' => 'skill',
'show_option_all' => false,
)
);?>
</div>

At the moment, the code is working on the from, but not inserting the tags in the post! When I retrieve the post, there are no tags.

If I use the previous code, it adds the tags to the post.

Please help! What am I doing wrong?

Complete code:

if (isset($_GET['return_url'])) {
    $return = $_GET['return_url'];
} else {
    $return = home_url();
}
$currency_code = ae_currency_code(false);
?>
<div class="step-wrapper step-post" id="step-post">
    <form class="post-job  post et-form" id="">
        <div class="form-group clearfix">
            <div class="input-group">
                <label for="post_title" class="input-label"><?php _e('Let\'s name your request', 'themes');?></label>
                <input type="text" class="input-item input-full" name="post_title" value="" required>
            </div>
        </div>
        <div class="form-group row clearfix <?php echo ('1' == ae_get_option('custom_price_mode') || is_super_admin($user_ID)) ? 'has-price-field' : ''; ?>">
            <?php if ('1' == ae_get_option('custom_price_mode') || is_super_admin($user_ID)): ?>
                <?php


?>
                <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 clearfix">
                    <div class="input-group">

                        <label for="et_budget"><?php printf(__('Your budget (%s)', 'themes'), $currency_code);?></label>
                        <input type="number" name="et_budget"  class="input-item et_budget" >

                    </div>
                </div>
            <?php endif?>

            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 delivery-area">
                <div class="input-group delivery-time">
                    <label for="time_delivery"><?php _e('Max time for a specialist to deliver (Day)', 'themes');?></label>
                    <input type="number" name="time_delivery" value="" class="input-item time-delivery" min="0">
                </div>
            </div>
            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 category-area">
                <div class="input-group">
                    <label for="job_category"><?php _e('Category', 'themes');?></label>
                    <?php
                        ae_tax_dropdown('job_category',
                        array('attr' => 'data-chosen-width="100%" data-chosen-disable-search=""  data-placeholder="' . __("Choose categories", 'themes') . '"',
                            'class' => 'chosen chosen-single tax-item required',
                            'hide_empty' => false,
                            'hierarchical' => true,
                            'id' => 'job_category',
                            'show_option_all' => false,
                        )
                    );?>
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="input-group">
                <label class="mb-20"><?php _e('Description', 'themes')?></label>
                <?php wp_editor('', 'post_content', ae_editor_settings());?>
            </div>
        </div>

        <div class="input-group">
            <label for="skill"><?php _e('Preferred Specialist Skills', 'themes');?></label>
            <?php
                ae_tax_dropdown('skill',
                array('attr' => 'data-chosen-width="100%" data-chosen-disable-search="" multiple data-placeholder="' . __("Choose tags", 'themes') . '"',
                    'class' => 'chosen-multi multi-tax-item required',
                    'hide_empty' => false,
                    'hierarchical' => true,
                    'id' => 'skill',
                    'show_option_all' => false,
                )
            );?>
        </div>

        <div class="form-group skill-control">
            <label><?php _e('Tags', 'themes');?></label>
            <input type="text" class="form-control text-field skill" id="skill" placeholder="<?php _e("Enter microjob tags", 'themes');?>" name=""  autocomplete="off" spellcheck="false" >
            <ul class="skills-list" id="skills_list"></ul>
        </div>

        <div class="form-group">
            <button class="<?php mje_button_classes(array('btn-save', 'waves-effect', 'waves-light'))?>" type="submit"><?php _e('SAVE', 'themes');?></button>
            <a href="<?php echo $return; ?>" class="btn-discard"><?php _e('DISCARD', 'themes');?></a>
            <input type="hidden" class="input-item post-service_nonce" name="_wpnonce" value="<?php echo de_create_nonce('ae-job_post-sync'); ?>" />
            <input type="hidden" class="input-item is_submit_request" name="is_submit_request" value="1">
            <input type="hidden" class="input-item post_type" name="post_type" value="<?php echo JOB_RECRUIT;?>">
        </div>
    </form>
</div>

Thanks in advance.

Share Improve this question edited Nov 5, 2018 at 1:32 Rifat asked Nov 4, 2018 at 15:27 RifatRifat 11 bronze badge 2
  • Neither of the codes you show will insert tags in the post. So there is something missing, possibly a script that is triggered by the id of the form. Moreover, ae_tax_dropdown is not a standard WP-function. – cjbj Commented Nov 4, 2018 at 16:27
  • Please see the post above, I have posted the total code. My apologies for not doing it earlier. – Rifat Commented Nov 5, 2018 at 1:20
Add a comment  | 

1 Answer 1

Reset to default 1

Your <form>-tag doesn't have an 'action' defined. This is an example of how it should look:

<form action="/form-retrieval-page.php" method="post">

So when you submit the form, then nothing is passed.

Post a comment

comment list (0)

  1. No comments so far