cizko
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: WP3.6 custom fields dropdown with strange behaviour after updateHehehe… alright. I’m not about busting your a.. if you are not one of those – well – let’s just call them “semi”-pros which seem to float around here a lot, bugging real pros for solutions and then charging their customers for copy and pasting those.
And I don’t think I will take you up on your offer – here in Germany our health care system is working pretty well. But thanks anyway. ??Forum: Fixing WordPress
In reply to: WP3.6 custom fields dropdown with strange behaviour after updateJust add the following right above the line “// Add your options:”
jQuery('#metakeyselect').find('option').remove(); $metakeyselect.append('<option value="#NONE#">— Select —</option>');
But seriously – google is your friend here. Consider yourself lucky that I am in a great mood today, since you can not expect other people to do all the work for you…
Forum: Fixing WordPress
In reply to: WP3.6 custom fields dropdown with strange behaviour after updateOh Daffydd57 – you are killing me here. Please tell me you are not making your money with wordpress…. ??
Forum: Fixing WordPress
In reply to: WP3.6 custom fields dropdown with strange behaviour after updateBTW: If I got my reading right, this is *not a bug* but intended behaviour as of WP 3.6
Forum: Fixing WordPress
In reply to: WP3.6 custom fields dropdown with strange behaviour after updatefiltering the list or simply resetting it to no content at all can be easily done with jquery…
Forum: Fixing WordPress
In reply to: WP3.6 custom fields dropdown with strange behaviour after updateI found a solution to this – or more likely a workaround. Append this to your theme’s functions.php and adjust the section “Add your options” accordingly to fit your needs:
/** * Programatically add custom fields. * * @see https://wordpress.stackexchange.com/questions/98269/programatically-add-options-to-add-new-custom-field-dropdown/ */ function wpse_98269_script() { if (isset($GLOBALS['post'])) { $post_type = get_post_type($GLOBALS['post']); if (post_type_supports($post_type, 'custom-fields')) { ?> <script> // Cache: var $metakeyinput = jQuery('#metakeyinput'), $metakeyselect = jQuery('#metakeyselect'); // Does the default input field exist and is it visible? if ($metakeyinput.length && ( ! $metakeyinput.hasClass('hide-if-js'))) { // Hide it: $metakeyinput.addClass('hide-if-js'); // Using WP admin class. // ... and create the select box: $metakeyselect = jQuery('<select id="metakeyselect" name="metakeyselect">').appendTo('#newmetaleft'); // Add the default select value: $metakeyselect.append('<option value="#NONE#">— Select —</option>'); } // Add your options: $metakeyselect.append("<option value='Your_option_1'>Your option 1</option>"); $metakeyselect.append("<option value='Your_option_2'>Your option 2</option>"); $metakeyselect.append("<option value='Your_option_3'>Your option 3</option>"); $metakeyselect.append("<option value='Your_option_4'>Your option 4</option>"); $metakeyselect.append("<option value='Your_option_5'>Your option 5</option>"); $metakeyselect.append("<option value='Your_option_6'>Your option 6</option>"); </script> <?php } } } add_action('admin_footer-post-new.php', 'wpse_98269_script'); add_action('admin_footer-post.php', 'wpse_98269_script');