Tag: wordpress

WordPress更新后的插件错误

我的托管服务提供商自动更新到4.5,导致Visual Composer插件出错。 我阅读了这些post: WordPress 4.5更新后插件抛出TypeError Visual composer不加载并给出TypeError:_. trylate(…)。trim不是函数 未捕获的TypeError:$ template.get不是函数 并将html2element函数替换为提供的函数。 但是,由于很多人对这些post发表了评论,我收到了一个新错误: composer-view.js?ver=4.6.1:139 Uncaught TypeError: Cannot read property ‘attributes’ of undefined 这是我的function: html2element: function(html) { var $template, attributes = {}, template = html; $template = $(template(this.model.toJSON()).trim()), _.each($template.get(0).attributes, function(attr) { attributes[attr.name] = attr.value }), this.$el.attr(attributes).html($template.html()), this.setContent(), this.renderContent() }, 错误似乎来自这一行: $template.get(0).attributes 有没有人想出如何解决它? 谢谢你的帮助

jQuery修复“未捕获的TypeError:$不是函数”错误

我的代码: external.js: $(“head”).append(unescape(“”)); 不幸的是,当我包含我的外部脚本时,我收到以下错误: 未捕获的TypeError:$不是函数 我该如何解决? 请记住,我不能编辑外部Javascript文件,因为它是第三方。

WooCommerce – 数量变化时自动更新总价

我一直在寻找好几天但我还没回答。 基本上,我正在尝试用ajax调用替换woocommerce标准“更新购物车”按钮,这会在数量变化时自动更新订单总价。 这是我的HTML Product1 name 2 000 × Product2 name 2 000 × 在functions.php中,我有一个更新总计的函数: public function update_total_price() { check_ajax_referer( ‘update_total_price’, ‘security’ ); if ( ! defined(‘WOOCOMMERCE_CART’) ) { define( ‘WOOCOMMERCE_CART’, true ); } $cart_updated = false; $cart_totals = isset( $_POST[‘cart’] ) ? $_POST[‘cart’] : ”; if ( sizeof( WC()->cart->get_cart() ) > 0 ) { foreach […]

无限滚动手动触发器

只是似乎没有工作… :-(已经看到更多的投诉,但我找不到答案。 问题:无限滚动有效但不是手动触发。 当我点击链接时,没有任何反应。 萤火虫给 无限滚动 我的代码: <?php echo ('’); ?> query(‘paged=’.$paged.’&cat=5&showposts=3&meta_key=video_video&orderby=meta_value&order=ASC’ . $post->ID); while ($wp_query->have_posts()) : $wp_query->the_post(); ?> ID, ‘video_video’, true) ) : ?> 290, “w” => 380, “zc” => 1, “q” =>100); //echo get(‘video_video’); echo (‘With: ‘); echo get(‘participant_first_name’); echo (‘ ‘); echo get(‘participant_last_name’); echo (”);?> ID, ‘video_video’, true) ) { ?> max_num_pages > […]

jQuery ajax请求有效,同样的AngularJS ajax请求没有

我正在学习AngularJS并尝试构建从Wordpress获取数据的前端系统。 在后端方面,一切似乎都正确设置,当我使用jQuery ajax请求时,它可以毫无问题地获取数据。 jQuery.ajax({ type: ‘POST’, url: ‘/wp-admin/admin-ajax.php’, data: { action: ‘getdataajax’ }, success: function(data, textStatus, XMLHttpRequest){ console.log(data); }, error: function(MLHttpRequest, textStatus, errorThrown){ console.log(errorThrown); } }); 但是当我尝试用AngularJS做同样的事情时,它不起作用。 我试图用这样的代码复制ajax请求: myApp.factory(‘productsData’, function($http, $log) { return { getProducts: function(successcb) { return $http({ method: ‘POST’, url: ‘/wp-admin/admin-ajax.php’, data: {action: ‘getdataajax’} }).success(function(data, status, headers, config) { successcb(data); $log.info(data, status, headers(), […]

将jquery ui-sortable位置保存到DB

我试图为一个拥有小型网络电台的朋友复制这个页面的function(http://www.kissfm.ro/fresh-top-40/)。 该网站是在wordpress fyi中设置的。 所以我的问题是,在搜索stackoverflow之后,如何根据用户输入保存/获取修订后的图表? 我找到了如何保存单个提交,但如何根据用户选择获得最终图表? 提前致谢! (代码或链接到欢迎教程!)

向下滚动时如何构建浮动菜单栏

当我向下滚动网站显示时,顶部的黑色菜单栏看起来像浮动条。 但我认为这涉及到jquery。 我试过CSS,但似乎不像我想要的那样为我工作 #menucontainer { position:fixed; top:0; height: 250px } #firstElement { margin-top: 250px } 这是我想要菜单的网站基本概念: http://avathemes.com/WP/Hexic/

Jquery window.send_to_editor

无法想出一个好头衔。 我有一个WordPress版本,我使用内置的WordPress媒体上传器上传多个图片。 它是如何工作的,在您上传并选择“插入”之后,jQuery将图像路径插入到包含ID的文本字段中。 保存后,文本字段将保存在选项表中。 如果您只有1个上传字段,则可以完美地工作 添加更多上传后,每个上传字段都会以相同的图片路径保存。 只需要每个上传按钮只插入其相关文本字段的值。 我试过使用.each但是无法让它正常工作。 还尝试使用.attr(’id’)来插入值,但没有做任何事情。 这是我的jQuery和标记: jQuery(‘.upload-button’).click(function() { formfield = jQuery(‘.upload’).attr(‘name’); tb_show(”, ‘media-upload.php?type=image&TB_iframe=true’); return false; }); window.send_to_editor = function(html) { imgurl = jQuery(‘img’,html).attr(‘src’); jQuery(‘.upload’).val(imgurl); tb_remove(); }; <div class="upload_field" <div class="upload_field" <div class="upload_field" 有关详细信息,请参阅我正在使用的上传器设置: http : //www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in-your-plugin-or-theme/ 一如既往,任何帮助都非常感谢。

如何在ajax调用中使用wordpress函数

我想知道是否有办法在ajax调用中使用query_post()这样的函数? 假设我正在调用文件_inc / ajax.php 我想能够使用wordpressfunction,但我不知道为什么。 有人可以帮助我吗? 非常感谢 :)

如何将自定义javascript添加到WordPress管理员?

我想在Edit Post页面添加一些自定义jquery代码,非常简单,比如当有人按下Publish时显示div。 唯一的限制是我希望通过使用插件来实现这一点,而不是破解管理模板文件。 我尝试使用某些动作回显一些脚本标签,但似乎不是这样。