mojtaba72 0 ارسال شده در مهر 99 گزارش بازنشر ارسال شده در مهر 99 سلام وقت بخیر من وقتی میخوام به کامنت های سایت جواب بدم صفحه یک بار ریلود میشه و ایجکس نیست قالب سایت اوکیه مشکلی نداره چه در دمو چه در یه سایت دیگه تست کردم اما برای من مشکل داره وقتی از کنسول نگاه میکنم این ارور رو میده Uncaught TypeError: Cannot read property 'textContent' of null at HTMLAnchorElement.a که برای فایل Comment-reply-main.js خود وردپرسه در حالت کلی بجای اینکه بعد از کلیک روی پاسخ از همون انکر استفاده بشه و آخر لینک هشتگ آی دی کامنت بخوره به آخر لینک ها ?replytocom=376617#respond اضافه میشه! کسی راه حلی برای این موضوع داره؟ بدون پلاگین ها هم تست کردم و همچنان مشکل پابرجاست محتوای فایل رو هم میذارم این پایین /*! This file is auto-generated */ window.addComment=function(p){var f,v,I,C=p.document,h={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=p.MutationObserver||p.WebKitMutationObserver||p.MozMutationObserver,i="querySelector"in C&&"addEventListener"in p,n=!!C.documentElement.dataset;function t(){r(),function(){if(!e)return;new e(o).observe(C.body,{childList:!0,subtree:!0})}()}function r(e){if(i&&(f=E(h.cancelReplyId),v=E(h.commentFormId),f)){f.addEventListener("touchstart",l),f.addEventListener("click",l);var t=function(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode)return v.removeEventListener("keydown",t),e.preventDefault(),v.submit.click(),!1};v&&v.addEventListener("keydown",t);for(var n,r=function(e){var t,n=h.commentReplyClass;e&&e.childNodes||(e=C);t=C.getElementsByClassName?e.getElementsByClassName(n):e.querySelectorAll("."+n);return t}(e),o=0,d=r.length;o<d;o++)(n=r[o]).addEventListener("touchstart",a),n.addEventListener("click",a)}}function l(e){var t=E(h.temporaryFormId);if(t&&I){E(h.parentIdFieldId).value="0";var n=t.textContent;t.parentNode.replaceChild(I,t),this.style.display="none";var r=E(h.commentReplyTitleId),o=r&&r.firstChild;o&&o.nodeType===Node.TEXT_NODE&&n&&(o.textContent=n),e.preventDefault()}}function a(e){var t=E(h.commentReplyTitleId),n=t&&t.firstChild.textContent,r=this,o=m(r,"belowelement"),d=m(r,"commentid"),i=m(r,"respondelement"),l=m(r,"postid"),a=m(r,"replyto")||n;o&&d&&i&&l&&!1===p.addComment.moveForm(o,d,i,l,a)&&e.preventDefault()}function o(e){for(var t=e.length;t--;)if(e[t].addedNodes.length)return void r()}function m(e,t){return n?e.dataset[t]:e.getAttribute("data-"+t)}function E(e){return C.getElementById(e)}return i&&"loading"!==C.readyState?t():i&&p.addEventListener("DOMContentLoaded",t,!1),{init:r,moveForm:function(e,t,n,r,o){var d=E(e);I=E(n);var i,l,a,m=E(h.parentIdFieldId),c=E(h.postIdFieldId),s=E(h.commentReplyTitleId),u=s&&s.firstChild;if(d&&I&&m){void 0===o&&(o=u&&u.textContent),function(e){var t=h.temporaryFormId,n=E(t),r=E(h.commentReplyTitleId),o=r?r.firstChild.textContent:"";if(n)return;(n=C.createElement("div")).id=t,n.style.display="none",n.textContent=o,e.parentNode.insertBefore(n,e)}(I),r&&c&&(c.value=r),m.value=t,f.style.display="",d.parentNode.insertBefore(I,d.nextSibling),u&&u.nodeType===Node.TEXT_NODE&&(u.textContent=o),f.onclick=function(){return!1};try{for(var y=0;y<v.elements.length;y++)if(i=v.elements[y],l=!1,"getComputedStyle"in p?a=p.getComputedStyle(i):C.documentElement.currentStyle&&(a=i.currentStyle),(i.offsetWidth<=0&&i.offsetHeight<=0||"hidden"===a.visibility)&&(l=!0),"hidden"!==i.type&&!i.disabled&&!l){i.focus();break}}catch(e){}return!1}}}}(window); نقل قول لینک به ارسال
Morteza 34190 ارسال شده در مهر 99 گزارش بازنشر ارسال شده در مهر 99 سلام 1- وردپرس نسخه آخر این مشکل رو نداره 2- ممکنه از کدهای پوسته تون باشه که بخشی از کدهای استاندارد دیدگاه رو نداره(احتمال زیاد همینه) 2 نقل قول لینک به ارسال
mojtaba72 0 ارسال شده در مهر 99 مالک گزارش بازنشر ارسال شده در مهر 99 (ویرایش شده) در در ۱۳۹۹/۷/۱۳ در 17:51، Morteza گفته است : سلام 1- وردپرس نسخه آخر این مشکل رو نداره 2- ممکنه از کدهای پوسته تون باشه که بخشی از کدهای استاندارد دیدگاه رو نداره(احتمال زیاد همینه) سلام ممنون از پاسختون اما به آخرین نسخه آپدیت کردم ولی همچنان مشکل داره کدهای قالب هم نیست چون همین نسخه از قالب رو یه سایت دیگه داریم و مشکلی نداره! بدون پلاگینها هم تست کردم و همچنان پابرجاست کدی که برای این کار تو قالب استفاده شده اینه: <?php /*** * BetterStudio Themes Core. * * ______ _____ _____ _ _____ * | ___ \/ ___| |_ _| | / __ \ * | |_/ /\ `--. | | | |__ ___ _ __ ___ ___ | / \/ ___ _ __ ___ * | ___ \ `--. \ | | | '_ \ / _ \ '_ ` _ \ / _ \ | | / _ \| '__/ _ \ * | |_/ //\__/ / | | | | | | __/ | | | | | __/ | \__/\ (_) | | | __/ * \____/ \____/ \_/ |_| |_|\___|_| |_| |_|\___| \____/\___/|_| \___| * * Copyright © 2017 Better Studio * * * Our portfolio is here: https://betterstudio.com/ * * \--> BetterStudio, 2018 <--/ */ /** * Functions for loading comment templates and some other handy function about comments.. * * @package BS Theme Core * @author BetterStudio <info@betterstudio.com> * @copyright Copyright (c) 2017, BetterStudio */ // Used to save comment template for better performance $GLOBALS['publisher_theme_core_comment_templates_cache'] = null; if ( ! function_exists( 'publisher_list_comments_args' ) ) { /** * Arguments for the wp_list_comments_function() used in comments.php. * * @param array $args * * @since 1.0.0 * * @return array */ function publisher_list_comments_args( $args = array() ) { // Default arguments for listing comments. $defaults = array( 'style' => 'ol', 'type' => 'all', 'avatar_size' => 60, 'callback' => 'publisher_comments_callback', 'end-callback' => 'publisher_comments_end_callback' ); // Filter default arguments to enable developers to change it. also return it. return apply_filters( 'publisher-theme-core/comments/list-args', bf_merge_args( $args, $defaults ) ); } } if ( ! function_exists( 'publisher_comments_callback' ) ) { /** * Determine which comment template should be used and save it to ache and locate. * * @param $comment object Comment object. * @param $args Array Arguments passed from wp_list_comments(). * @param $depth Int Comment level. * * @since 1.0.0 * * @return void */ function publisher_comments_callback( $comment, $args, $depth ) { global $publisher_theme_core_comment_templates_cache; // current comment type $comment_type = get_comment_type( $comment->comment_ID ); $style = publisher_get_style(); if ( $style == 'default' ) { $style = 'general'; } // fix for new structure // Not cached before if ( ! isset( $publisher_theme_core_comment_templates_cache[ $comment_type ] ) ) { $templates = array(); // Extra comment/ping.php for both pingback and trackback if ( 'pingback' == $comment_type || 'trackback' == $comment_type ) { $templates[] = "views/{$style}/comments/ping.php"; // Fallback to general ping comment template if ( $style != 'general' ) { $templates[] = 'views/general/comments/ping.php'; } } $templates[] = "views/{$style}/comments/comment.php"; // fallback to default comment template if ( $style != 'general' ) { $templates[] = 'views/general/comments/comment.php'; } $template = locate_template( $templates ); // Cache comment template. $publisher_theme_core_comment_templates_cache[ $comment_type ] = $template; } // Include if not empty if ( $publisher_theme_core_comment_templates_cache[ $comment_type ] != '' ) { include $publisher_theme_core_comment_templates_cache[ $comment_type ]; } } } if ( ! function_exists( 'publisher_is_ajaxified_comments_active' ) ) { /** * Determinate is comment ajax loading (deferred) enabled for this request * * @return bool true if enable */ function publisher_is_ajaxified_comments_active() { return ( ! bf_is_doing_ajax() || defined( 'PUBLISHER_THEME_AJAXIFIED_LOAD_POST' ) && PUBLISHER_THEME_AJAXIFIED_LOAD_POST ) && ( empty( $GLOBALS['cpage'] ) || intval( $GLOBALS['cpage'] ) === 1 ); } } add_filter( 'comment_post_redirect', 'publisher_comment_post_redirect' ); if ( ! function_exists( 'publisher_comment_post_redirect' ) ) { /** * Handy function to add 'bs-comment-added' to query string after inserting comment * * @access private * * @param $location * * @return string */ function publisher_comment_post_redirect( $location ) { $location = add_query_arg( array( 'bs-comment-added' => '1', ), $location ); return $location; } } if ( ! function_exists( 'publisher_comments_end_callback' ) ) { /** * Ends the display of comments. * * @since 1.0.0 * * @return void */ function publisher_comments_end_callback() { echo '</li><!-- .comment -->'; } } if ( ! function_exists( 'publisher_echo_comment_reply_link' ) ) { /** * Outputs the comment reply link. * Only use outside of `wp_list_comments()`. * * @param array $args * * @since 1.0.0 * @access public * * @return void */ function publisher_echo_comment_reply_link( $args = array() ) { echo publisher_get_comment_reply_link( $args ); // escaped before } } if ( ! function_exists( 'publisher_get_comment_reply_link' ) ) { /** * Outputs the comment reply link. * Only use outside of `wp_list_comments()`. * * @param array $args * * @since 2.0.0 * @access public * * @return string */ function publisher_get_comment_reply_link( $args = array() ) { $_check = array( 'pingback' => '', 'trackback' => '', ); if ( ! get_option( 'thread_comments' ) || isset( $_check[ get_comment_type() ] ) ) { return ''; } $login_to_reply_text = publisher_translation_get( 'comments_login_to_reply' ); if ( empty( $login_to_reply_text ) ) { $login_to_reply_text = publisher_translation_get( 'comments_reply' ); } $args = bf_merge_args( $args, array( 'depth' => intval( $GLOBALS['comment_depth'] ), 'max_depth' => get_option( 'thread_comments_depth' ), 'reply_text' => '<i class="fa fa-reply"></i> ' . publisher_translation_get( 'comments_reply' ), 'reply_to_text' => '<i class="fa fa-reply"></i> ' . publisher_translation_get( 'comments_reply_to' ), 'login_text' => '<i class="fa fa-reply"></i> ' . $login_to_reply_text, ) ); return get_comment_reply_link( $args ); } } if ( ! function_exists( 'publisher_get_comment_avatar' ) ) { /** * @param string $id_or_email * @param string $size * @param string $default * @param bool $alt * * @return false|string */ function publisher_get_comment_avatar( $id_or_email, $size = '60', $default = '', $alt = false ) { return get_avatar( $id_or_email, $size, $default, $alt ); } } if ( ! function_exists( 'publisher_echo_comment_avatar' ) ) { /** * @param string $id_or_email * @param string $size * @param string $default * @param bool $alt * * @return false|string */ function publisher_echo_comment_avatar( $id_or_email, $size = '60', $default = '', $alt = false ) { echo publisher_get_comment_avatar( $id_or_email, $size, $default, $alt ); // escaped before } } ویرایش شده مهر 99 توسط mojtaba72 نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .