I’m unable to call img path using single quotes in an array?

You’re trying to use PHP tags while inside a string: ‘<img src=”https://wordpress.stackexchange.com/questions/302344/<?php bloginfo(“template_directory’); ?>/images/social/facebook-share.png” />’ You need to instead use concatenation: ‘<img src=”‘ . esc_url( get_bloginfo(‘template_directory’) ) . ‘/images/social/facebook-share.png” />’ Or my personal favorite, sprintf(): sprintf( ‘<img src=”https://wordpress.stackexchange.com/questions/302344/%1$s/images/social/facebook-share.png” />’, esc_url( get_bloginfo(‘template_directory’) ) );

Full Front End, AJAX comment system and comment reply script

<script> var addComment = { settings: function( parentId, postId ) { var t = $(this), commentDivName = $(‘#comment-‘+parentId), formDivName = $(‘#commentForm-‘+postId), formReplyDivName = $(‘#commentReplyForm-‘+parentId), postDivName = $(‘#post-‘+postId), theform = formDivName.find(‘form.comment-form’); if( !t.length || !commentDivName.length || !formDivName.length || !postDivName.length ) { return; } if(!theform.length){ $(postDivName).find(‘[id^=commentReplyForm-]’).each(function(){ if($(this).find(‘form.comment-form’).length){ formDivName = $(‘#’+$(this).attr(‘id’)); } }); theform = formDivName.find(‘form.comment-form’); } theform.find(‘input[name=parent]’).val(parentId); … Read more

Comment form on custom page template

If you want to display default WordPress comment form then you need to call comments_template() in your template. Make sure that comment_status should be open for the particular post that you want to display the comment form. <?php comments_template(); ?> Read more here https://developer.wordpress.org/reference/functions/comments_template/

how to load the comment template from a plugin

You can use the comments_template filter to alter which file your CPT will use for comments. function wpse_plugin_comment_template( $comment_template ) { global $post; if ( !( is_singular() && ( have_comments() || ‘open’ == $post->comment_status ) ) ) { // leave the standard comments template for standard post types return; } if($post->post_type == ‘business’){ // assuming … Read more

How to display comments length

I used this: function wpb_countx() { wp_enqueue_script(‘jquery’); ?> <script> jQuery(function($) { // configure var comment_input = $( ‘#commentform textarea’ ); var submit_button = $( ‘#commentform .form-submit’ ); var comment_limit_chars = 1400; // stop editing here // display how many characters are left $( ‘<div class=”comment_limit_info”><span>’ + comment_limit_chars + ‘</span> zbývá znaků</div>’ ).insertAfter( comment_input ); comment_input.bind( … Read more

Use of comment_reply_link_args filter

You mean, something like this? add_filter( ‘comment_reply_link_args’, ‘change_author_title’, 10, 2 ); function change_author_title( $args, $comment ) { $args[‘reply_to_text’] = ‘Reply to ‘ . get_comment_author( $comment ); return $args; } Explanation: I changed the function declaration so that it accepts the second parameter ($comment) which is the comment object (a WP_Comment instance), then I simply call … Read more

How to make comments private for commentor and post author

You can use the pre_get_comments filter to modify the parameters of the comment query before it fetches the comments. Specifically the author_in parameter. I tried to write an example, though I haven’t tested it, but it would be similar to this: add_action( ‘pre_get_comments’, ‘author_and_self_comment_filter’ ); function author_and_self_filter( \WP_Comment_Query $query ) : void { // We … Read more

How To Detect Posted Comment in Theme Development?

The easiest and most straight-forward way is to put appropriate code in your wp_list_comments() callback, that outputs a message if a comment is awaiting moderation. The usual code looks something like this: <?php if ($comment->comment_approved == ‘0’) : ?> <em><?php _e(‘Your comment is awaiting moderation.’) ?> Otherwise, if you’re not using a callback, you can … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)