Hi,
I've been perfecting my previous code to move custom fields on Ad posting / editing, and I think this is pretty advanced now:
Add this at the very bottom of your theme functions.php:
Notes:
1.- Take care not to leave blank lines after this.
2.- If your theme functions.php doesn't end with ?> skip first line of my code.
<?php
function custom_move_custom_field() {
$section = Rewrite::newInstance()->get_section();
if ($section == 'item_add' || $section == 'item_edit') { ?>
<script type="text/javascript">
$("#catId").ajaxComplete(function(){
// Change these two values
var customFieldIdentifier = 'art_der_anzeige';
var destinationElement = $("label[for='select_1']").parent('div');
var toMoveLabel = $("label[for='meta_" + customFieldIdentifier + "']");
if (toMoveLabel.length && !$('#moved_custom_field').html()) {
$("<div></div>").attr('id', 'moved_custom_field').insertBefore(destinationElement);
$("<div></div>").attr('class', 'clear').css('padding-bottom', '10px').insertBefore(destinationElement);
toMoveLabel.parent('.meta').find('*').each(function( index, value ) {
$(this).copyCSS($(this));
});
$("#moved_custom_field").append(toMoveLabel.parent('.meta'));
} else {
$("#moved_custom_field").remove();
}
});
$.fn.copyCSS = function (source) {
var dom = $(source).get(0);
var dest = {};
var style, prop;
if (window.getComputedStyle) {
var camelize = function (a, b) {
return b.toUpperCase();
};
if (style = window.getComputedStyle(dom, null)) {
var camel, val;
if (style.length) {
for (var i = 0, l = style.length; i < l; i++) {
prop = style[i];
camel = prop.replace(/\-([a-z])/, camelize);
val = style.getPropertyValue(prop);
dest[camel] = val;
}
} else {
for (prop in style) {
camel = prop.replace(/\-([a-z])/, camelize);
val = style.getPropertyValue(prop) || style[prop];
dest[camel] = val;
}
}
return this.css(dest);
}
}
if (style = dom.currentStyle) {
for (prop in style) {
dest[prop] = style[prop];
}
return this.css(dest);
}
if (style = dom.style) {
for (prop in style) {
if (typeof style[prop] != 'function') {
dest[prop] = style[prop];
}
}
}
return this.css(dest);
};
</script>
<?php }
}
osc_add_hook('footer', 'custom_move_custom_field', 1);
function custom_remove_moved_custom_field() { ?>
<script type="text/javascript">
$("#moved_custom_field").remove();
</script>
<?php }
osc_add_hook('item_form', 'custom_remove_moved_custom_field', '6');
?>
Try it and tell me if everything's all right.
Regards