Advertisement
shakil97bd

How to add comment template in wordpress - post/page

Feb 3rd, 2015
561
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 5.43 KB | None | 0 0
  1. **************** How to add comment template in wordpress - post/page **************
  2.  
  3.  
  4. //first past this code in function.php to register comment-template
  5.  
  6.                 /*This is for register Comment template*/
  7.                 function comment_scripts(){
  8.  
  9.                    if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
  10.  
  11.                 }
  12.  
  13.                 add_action( 'wp_enqueue_scripts', 'comment_scripts' );
  14.  
  15.  
  16.  
  17. //than past this code in where you want to call comment-template
  18.  
  19.  
  20.                 <?php comments_template( '', true ); ?>
  21.                
  22.  
  23.  
  24. ***************************** CSS For Comment Template **************************
  25.  
  26. //You can use this CSS code for design your comment template.This is the wordpress default design.
  27.  
  28. //First create a comments.css file and past this css code on this css file and put this file in your theme css folder and call this css file in theme.
  29.  
  30.  
  31. /* ===================== comments ===================== */
  32.  
  33. .comments {margin: 10px 0;}
  34. .comments h3 {margin:50px 0 30px 0;font-size:24px;}
  35. ol.commentlist { list-style:none; margin:0 0 1em; padding:0; text-indent:0; }
  36. ol.commentlist li { }
  37. ol.commentlist li.alt { }
  38. ol.commentlist li.bypostauthor {}
  39. ol.commentlist li.byuser {}
  40. ol.commentlist li.comment-author-admin {}
  41. ol.commentlist li.comment { border-bottom: 1px solid #ddd; padding:1em; margin-bottom: 10px; }
  42. ol.commentlist li div.comment-author {}
  43. ol.commentlist li div.vcard { font-size:20px;}
  44. ol.commentlist li div.vcard cite.fn { font-style:normal; }
  45. ol.commentlist li div.vcard cite.fn a.url {}
  46. ol.commentlist li div.vcard img.avatar {float:left; margin:0 1em 1em 0; }
  47. ol.commentlist li div.vcard img.avatar-32 {}
  48. ol.commentlist li div.vcard img.photo {}
  49. ol.commentlist li div.vcard span.says {}
  50. ol.commentlist li div.commentmetadata {}
  51. ol.commentlist li div.comment-meta { font-size:9px; margin-bottom: 10px;}
  52. ol.commentlist li div.comment-meta a { color: #aaa; }
  53. ol.commentlist li p { margin: 0; }
  54. ol.commentlist li ul { list-style:square; margin:0 0 1em 2em; }
  55. ol.commentlist li div.reply { font-size:11px; }
  56. ol.commentlist li div.reply a { font-weight:bold; }
  57. ol.commentlist li ul.children { list-style:none; margin:1em 0 0; text-indent:0; }
  58. ol.commentlist li ul.children li {}
  59. ol.commentlist li ul.children li.alt {}
  60. ol.commentlist li ul.children li.bypostauthor {}
  61. ol.commentlist li ul.children li.byuser {}
  62. ol.commentlist li ul.children li.comment {}
  63. ol.commentlist li ul.children li.comment-author-admin {}
  64. ol.commentlist li ul.children li.depth-2 { margin:0 0 .25em .25em; }
  65. ol.commentlist li ul.children li.depth-3 { margin:0 0 .25em .25em; }
  66. ol.commentlist li ul.children li.depth-4 { margin:0 0 .25em .25em; }
  67. ol.commentlist li ul.children li.depth-5 {}
  68. ol.commentlist li ul.children li.odd {}
  69. ol.commentlist li.even { background:#fff; }
  70. ol.commentlist li.odd { background:#f6f6f6; }
  71. ol.commentlist li.parent { }
  72. ol.commentlist li.pingback { margin: 0 0 10px; padding: 1em; border: 1px dashed #ccc; }
  73. ol.commentlist li.thread-alt { }
  74. ol.commentlist li.thread-even { }
  75. ol.commentlist li.thread-odd {}
  76.  
  77. /* ===================== comment form ===================== */
  78.  
  79. #respond {position: relative;}
  80. #respond input[type="text"],#respond textarea {border:1px solid #ddd;padding:10px}
  81. #respond input[type="text"] {padding:7px;width:300px}
  82. #respond .comment-form-author,
  83. #respond .comment-form-email,
  84. #respond .comment-form-url,
  85. #respond .comment-form-comment { position: relative; }
  86. #respond .comment-form-author label,
  87. #respond .comment-form-email label,
  88. #respond .comment-form-url label,
  89. #respond .comment-form-comment label { background: #eee; color: #555; display: inline-block; left: 4px; min-width: 60px; padding: 4px 10px; position: relative; top: 40px; z-index: 1; }
  90. #respond input[type="text"]:focus,
  91. #respond textarea:focus { text-indent: 0; z-index: 1; }
  92. #respond textarea { resize: vertical; width: 95%; }
  93. #respond .comment-form-author .required,
  94. #respond .comment-form-email .required { color: #bd3500; font-size: 22px; font-weight: bold; left: 75%; position: absolute; top: 45px; z-index: 1; }
  95. #respond .comment-notes,
  96. #respond .logged-in-as { font-size: 13px; }
  97. #respond p { margin: 10px 0; }
  98. #respond .form-submit { float: right; margin: -20px 0 10px; }
  99. #respond input#submit { background: #454545; border: none; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0px 1px 2px rgba(0,0,0,0.3); -moz-box-shadow: 0px 1px 2px rgba(0,0,0,0.3); box-shadow: 0px 1px 2px rgba(0,0,0,0.3); color: #eee; cursor: pointer; padding: 5px 42px 5px 22px;
  100. width: auto;
  101.  }
  102. #respond input#submit:active { background: #86222D; color: #fff; }
  103. #respond #cancel-comment-reply-link { color: #666; margin-left: 10px; text-decoration: none; }
  104. #respond .logged-in-as a:hover,
  105. #respond #cancel-comment-reply-link:hover { text-decoration: underline; }
  106. .commentlist #respond { margin: 1.625em 0 0; width: auto; }
  107. #reply-title { color: #373737; font-size: 20px; }
  108. #cancel-comment-reply-link { color: #888; display: block; position: absolute; right: 1.625em; text-decoration: none; text-transform: uppercase; top: 1.1em; }
  109. #cancel-comment-reply-link:focus,
  110. #cancel-comment-reply-link:active,
  111. #cancel-comment-reply-link:hover { color: #ff4b33; }
  112. #respond label {display: block; float: right; font-size: 16px; line-height: 2.2em; width: 280px;}
  113. #respond input[type=text] {}
  114. #respond p { font-size: 12px; }
  115. p.comment-form-comment { margin: 0; }
  116. .form-allowed-tags { display: none; }
  117. .trackback { margin: 0 0 10px; padding: 1em; border: 1px dashed #ccc; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement