Skip to content

Instantly share code, notes, and snippets.

@GuillaumeJasmin
Created June 1, 2014 17:42
Show Gist options
  • Save GuillaumeJasmin/1cf314f59d09294245ac to your computer and use it in GitHub Desktop.
Save GuillaumeJasmin/1cf314f59d09294245ac to your computer and use it in GitHub Desktop.
fix bug from wordpress theme: Syntac -Wordpress Premium Personal Portfolio
jQuery(function ($) {
jQuery('td.description').hide();
jQuery('td.select_video input').each(function () {
$this = jQuery(this);
if ($this.is(':checked')) {
$this.parent().parent().find('td.description').show();
$this.parent().parent().find('td.image_upload').hide();
}else {
$this.parent().parent().find('td.description').hide();
$this.parent().parent().find('td.image_upload').show();
}
});
function bind_add_video_click() {
jQuery('td.select_video input').live('click',function () {
$this = jQuery(this);
if ($this.is(':checked')) {
$this.parent().parent().find('td.description').slideDown();
$this.parent().parent().find('td.image_upload').slideUp();
} else {
$this.parent().parent().find('td.description').slideUp();
$this.parent().parent().find('td.image_upload').slideDown();
}
});
}
bind_add_video_click();
// fix by Guillaume Jasmin
// $('.meta_box_upload_image_button').click(function () {
$('.meta_box_upload_image_button').live('click',function () {
formID = $(this).attr('rel');
formfield = $(this).siblings('.meta_box_upload_image');
preview = $(this).siblings('.meta_box_preview_image');
tb_show('Choose', 'media-upload.php?post_id=' + formID + '&type=image&custom=simple&TB_iframe=1');
window.orig_send_to_editor = window.send_to_editor;
window.send_to_editor = function (html) {
img = $('img', html);
imgurl = img.attr('src');
classes = img.attr('class');
id = classes.replace(/(.*?)wp-image-/, '');
formfield.val(imgurl);
formfield.next().val(id);
preview.attr('src', imgurl);
tb_remove();
window.send_to_editor = window.orig_send_to_editor
};
bind_add_video_click();
//return false
});
$('.meta_box_clear_image_button').live('click', function () {
var defaultImage = $(this).parent().find('.meta_box_default_image').text();
$(this).parent().find('.meta_box_upload_image').val('');
$(this).parent().find('.meta_box_upload_image').next().val('');
$(this).parent().find('.meta_box_preview_image').attr('src', defaultImage);
return false
});
$('.meta_box_repeatable_add').live('click', function () {
var row = $(this).closest('.meta_box_repeatable').find('tbody tr:last-child');
var clone = row.clone();
clone.find('input[type=text],input[type=checkbox], input[type=hidden], textarea').val('');
var defaultImage = $(this).parent().parent().parent().parent().find('.meta_box_default_image').first().text();
clone.find('.meta_box_preview_image').attr('src', defaultImage);
row.after(clone);
// fix by Guillaume Jasmin
// clone.find('input.regular-text, input[type=hidden], textarea').attr('name', function (index, name) {
clone.find('input.regular-text, input[type=hidden], textarea, input[type="text"]').attr('name', function (index, name) {
return name.replace(/(\d+)/, function (fullMatch, n) {
return Number(n) + 1
})
});
return false
});
$('.meta_box_repeatable_remove').live('click', function () {
$(this).closest('tr').remove();
return false
});
$('.meta_box_repeatable tbody').sortable({
opacity: 0.6,
revert: true,
cursor: 'move'
})
});
@rodrigophpweb
Copy link

Hello Guilherme, how are you?
Let me ask you do you have thema Syntac?

I'm almost 2 years looking for contact with the developer but it seems to me that it is not being commercialized anymore.

I wonder if you have it? If so, could you make it available for me to download?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment