CSS Styled Option Buttons? - css

I'm working through some touches on an e-commerce site for someone and have run into something I'm not sure about. The product page currently has radio buttons for choosing a product size. I had a drop down menu in before. The client wants styled square buttons similar to those on here.
Section of my code currently reads...
<td valign="top" width="910">
<div id="content"><?php echo $content_top; ?>
<h1><?php echo $heading_title; ?></h1>
<div class="right">
<?php if ($price) { ?>
<div class="price">
<?php if (!$special) { ?>
<?php echo $price; ?>
<?php } else { ?>
<span class="price-old"><?php echo $price; ?></span> <span class="price-new"><?php echo $special; ?></span>
<?php } ?>
<br />
<?php if ($tax) { ?>
<?php } ?>
<?php if ($points) { ?>
<span class="reward"><small><?php echo $text_points; ?> <?php echo $points; ?></small></span> <br />
<?php } ?>
<?php if ($discounts) { ?>
<br />
<div class="discount">
<?php foreach ($discounts as $discount) { ?>
<?php echo sprintf($text_discount, $discount['quantity'], $discount['price']); ?><br />
<?php } ?>
</div>
<?php } ?>
</div>
<?php
$get_meta_desc = "SELECT meta_description
FROM product_description
WHERE product_id = '".$product_id."'";
$get_meta_res = mysql_query($get_meta_desc);
$meta_desc = mysql_fetch_array($get_meta_res, MYSQL_ASSOC);
if ($meta_desc['meta_description']) {
echo "<p id=\"cmmeta-desc\">".$meta_desc['meta_description']."</p>";
}
mysql_free_result($get_meta_res);
?>
<?php } ?>
<?php if ($options) { ?>
<div class="options">
<?php foreach ($options as $option) { ?>
<?php if ($option['type'] == 'select') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<select name="option[<?php echo $option['product_option_id']; ?>]">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($option['option_value'] as $option_value) { ?>
<option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</option>
<?php } ?>
</select>
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'radio') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<?php foreach ($option['option_value'] as $option_value) { ?>
<input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
<label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</label>
<br />
<?php } ?>
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'checkbox') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<?php foreach ($option['option_value'] as $option_value) { ?>
<input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
<label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"> <?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</label>
<br />
<?php } ?>
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'text') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" />
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'textarea') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<textarea name="option[<?php echo $option['product_option_id']; ?>]" cols="40" rows="5"><?php echo $option['option_value']; ?></textarea>
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'file') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<a id="button-option-<?php echo $option['product_option_id']; ?>" class="button"><span><?php echo $button_upload; ?></span></a>
<input type="hidden" name="option[<?php echo $option['product_option_id']; ?>]" value="" />
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'date') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="date" />
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'datetime') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="datetime" />
</div>
<br />
<?php } ?>
<?php if ($option['type'] == 'time') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="time" />
</div>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
<div class="cart">
<div><?php echo $text_qty; ?>
<input type="text" name="quantity" size="2" value="<?php echo $minimum; ?>" />
<input type="hidden" name="product_id" size="2" value="<?php echo $product_id; ?>" />
<a id="button-cart" class="button2"><span>ADD TO BAG</span></a></div>
<?php if ($minimum > 1) { ?>
<div class="minimum"><?php echo $text_minimum; ?></div>
<?php } ?>
</div>
Never really done anything like these before...
Many Thanks
L

This is a really good tutorial on styling radio buttons.
http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/
From there you can get what your after pretty easily :)
Hope this helps you out!

In the site you linked, they are using a select element with the options inside it. It is then hidden with Javascript, and a list of links (a) is constructed using the dropdown options, which can be easily styled. If you click one of the links, they are tied to the original select element. This can be easily achieved with Javascript.
If you disable Javascript in your browser, and check out that site, you will see the underlying form elements.
Unfortunately, elements like radio buttons, checkboxes and dropdowns cannot really be styled through CSS, only in a very limited way. Most solutions (like the one posted by #Graeme, but there are thousand others) use Javascript to hide these elements and use a substitute element whose actions are linked to the original element.
If you only want to use CSS, there is a tricky CSS3 solution, but it will only work in modern browsers (no IE8 or lower). You can see an example in one of my previous posts: Custom Checkbox .

I think you are referring to the 'GO' button. This is an input element of the type image. Which means it's a clickable button that consists of an image. So in order to get the nice square button, you have to create an image, upload it, and refer to it in the src attribute of your input tag.
Here's an example that looks quite dated, but is simple and straight forward: http://www.echoecho.com/htmlforms14.htm
It also describes the options.
Perhaps a useful tip, if you're not already using it: if you come across something on a site that you want to use, use an inspection tool, like Firebug for Firefox, to see how it's made.
EDIT:
The product size buttons are not actually radio buttons, they are list items <li> and styled using CSS. The value that they represent, are registered using a piece of javascript. This info is posted when you hit the submit button. I don't know If you're familiar with javascript and/or are using a javascript framework, but your situation would be a good one to utilize it.
I've created this jsfiddle with a very straightforward solution, using plain javascript: http://jsfiddle.net/r2K9h/3/
it sets a hidden input field with the size selected. So when you send the form, this value will be submitted as well.

Related

WordPress search results not displaying

I am using the naked word press theme to build my site with and it all works great apart from when I use the search bar. I type in my search and it takes me to a version of my homepage, but with no content on it.
How do I get my search results to display?
Create a search.php and use this code as an example.
<?php get_header(); ?>
<div id="content">
<?php if (have_posts()) : ?>
<h1>Search Result for <?php /* Search Count */ $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<span class="search-terms">'); echo $key; _e('</span>'); _e(' — '); echo $count . ' '; _e('acapellas'); wp_reset_query(); ?></h1>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li>
<h2><?php the_title(); ?></h2>
<p><?php the_excerpt(); ?></p>
</li>
<?php endwhile; endif; ?>
</ul>
</div>
<?php get_footer(); ?>
Make sure your searchform.php complies with Wordpress's standards, heres an example.
<form method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
<label>
<span class="screen-reader-text"><?php echo _x( 'Search:', 'label' ) ?></span>
<span>Search</span>
<input type="search" class="search-field" placeholder="Search" value="<?php echo get_search_query() ?>" name="s" title="<?php echo esc_attr_x( 'Search:', 'label' ) ?>" />
</label>
<button type="submit" class="search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button' ) ?>">
</button>
</form>

Previous post is shown after submitting a comment

What is wrong with my code that it results in page going to the previous post after submitting a comment?
This is the webpage.
You may try if you want.
This is the code from comments.php:
<?php
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if ( post_password_required() ) { ?>
This post is password protected. Enter the password to view comments.
<?php
return;
}
?>
<?php if ( have_comments() ) : ?>
<h2 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?></h2>
<div class="navigation">
<div class="next-posts"><?php previous_comments_link() ?></div>
<div class="prev-posts"><?php next_comments_link() ?></div>
</div>
<ol class="commentlist">
<?php wp_list_comments(); ?>
</ol>
<div class="navigation">
<div class="next-posts"><?php previous_comments_link() ?></div>
<div class="prev-posts"><?php next_comments_link() ?></div>
</div>
<?php else : // this is displayed if there are no comments so far ?>
<?php if ( comments_open() ) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<p>Comments are closed.</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( comments_open() ) : ?>
<div id="respond">
<h2><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h2>
<div class="cancel-comment-reply">
<?php cancel_comment_reply_link(); ?>
</div>
<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
<p>You must be logged in to post a comment.</p>
<?php else : ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if ( is_user_logged_in() ) : ?>
<p>Logged in as <?php echo $user_identity; ?>. Log out »</p>
<?php else : ?>
<div>
<input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="author">Name <?php if ($req) echo "(required)"; ?></label>
</div>
<div>
<input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="email">Mail (will not be published) <?php if ($req) echo "(required)"; ?></label>
</div>
<div>
<input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
<label for="url">Website</label>
</div>
<?php endif; ?>
<!--<p>You can use these tags: <code><?php echo allowed_tags(); ?></code></p>-->
<div>
<textarea name="comment" id="comment" cols="58" rows="10" tabindex="4"></textarea>
</div>
<div>
<input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
<?php comment_id_fields(); ?>
</div>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
I read this question but don't understand what the solution is.
What do I do to get <?php do_action( 'comment_form', $post->ID ); ?> to behave as expected?
UPDATE:
This is my single.php and as you see, $post is set so don't know what the issue can be:
<?php get_header(); ?>
<nav>
<?php wp_nav_menu(array('menu' => 'Main Nav Menu')); ?>
</nav>
<div id="main-content">
<div class="post-bg-single">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<div class="post-title-single"><h2><?php the_title(); ?></h2></div>
<h5 class="date-single">Posted on <?php the_time(get_option('date_format')); ?></h5>
<div class="separator-up-single"></div>
<div class="thumbnail-single"><?php
if( has_post_thumbnail() ){
echo get_the_post_thumbnail(); // or just simply, the_post_thumbnail()
}
?></div>
<div class="entry">
<?php the_content(); ?>
<h5 class="expand">Expand post area</h5>
<!-- <h5 class="print">Printable version</h5> -->
</div>
<div class="separator-down"></div>
<h5 class="categories">Categories: <?php the_category(', ') ?></h5>
<h5 class="tags"><?php the_tags('Tags: ', ', ', '<br />'); ?></h5>
<h5 class="edit"><?php edit_post_link(__('→ Edit post← '), ''); ?></h5>
</div>
</div>
<h84>Read more:</h84>
<div id="related-posts">
<?php
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args=array(
'category__in' => $category_ids,
'post__not_in' => array($post->ID),
'showposts'=>4, // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
echo '
<ul>';
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<?php $bg_image = post_thumb( get_the_post_thumbnail() );?>
<a href="<?php the_permalink() ?>"><div class="post-bg-archive" style="background: #777777 url(<?php echo $bg_image;?>);">
<div id="title-bg">
<div class="transparency"></div>
<div class="archive-title"><h10><?php the_title(); ?></h10></div>
</div>
</div></a>
<?php
}
echo '</ul>';
}
}
?>
</div>
<div class="comments-bg">
<?php comments_template(); ?>
</div>
<?php endwhile; endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
When you do a new WP_Query, it overwrite the global $post variable with the new query.
Either try get_posts() and rewriting the query or add in wp_reset_query(); right before calling comments_template();
wp_reset_query(); would be the fastest way to get it displaying properly.

Can we display Joomla Login Module in WordPress?

Hi I am using Joomla and WordPress both and I use a single sign-on plugin which is Joomla based. Now the issue is that it is kind of one-way login management.
What I mean is When a user logs into Joomla he automatically gets logged into WordPress and similarly when a user registers into Joomla his details are automatically replicated into WordPress. This activity does not happen when a user logs into or registers from WordPress.
So I wanted to know Is there a way to display the Joomla Login module in the WordPress pages so that when a user logs in from a WordPress page he gets his credentials checked from the Joomla database and the rest is handled by my Joomla Single-signon plugin.
Or is there a better way around?
Kindly suggest.
The code for my Joomla Login Module is somewhat like this:
<?php
defined('_JEXEC') or die('Restricted access'); ?>
<?php if($type == 'logout') : ?>
<form action="index.php" method="post" name="login" id="form-login">
<?php if ($params->get('greeting')) : ?>
<div class="user-greeting">
<?php if ($params->get('name')) : {
echo JText::sprintf( 'HINAME', $user->get('name') );
} else : {
echo JText::sprintf( 'HINAME', $user->get('username') );
} endif; ?>
</div>
<?php endif; ?>
<div class="readon"><input type="submit" name="Submit" class="button" value="<?php echo JText::_( 'BUTTON_LOGOUT'); ?>" /></div>
<input type="hidden" name="option" value="com_user" />
<input type="hidden" name="task" value="logout" />
<input type="hidden" name="return" value="<?php echo $return; ?>" />
</form>
<?php else : ?>
<?php if(JPluginHelper::isEnabled('authentication', 'openid')) :
$lang->load( 'plg_authentication_openid', JPATH_ADMINISTRATOR );
$langScript = 'var JLanguage = {};'.
' JLanguage.WHAT_IS_OPENID = \''.JText::_( 'WHAT_IS_OPENID' ).'\';'.
' JLanguage.LOGIN_WITH_OPENID = \''.JText::_( 'LOGIN_WITH_OPENID' ).'\';'.
' JLanguage.NORMAL_LOGIN = \''.JText::_( 'NORMAL_LOGIN' ).'\';'.
' var modlogin = 1;';
$document = &JFactory::getDocument();
$document->addScriptDeclaration( $langScript );
JHTML::_('script', 'openid.js');
endif; ?>
<form action="<?php echo JRoute::_( 'index.php', true, $params->get('usesecure')); ?>" method="post" name="login" id="form-login" >
<?php echo $params->get('pretext'); ?>
<fieldset class="input">
<p id="form-login-username">
<label for="modlgn_username"><?php echo JText::_('Username') ?></label><br />
<input id="modlgn_username" type="text" name="username" class="inputbox" alt="username" size="18" />
</p>
<p id="form-login-password">
<label for="modlgn_passwd"><?php echo JText::_('Password') ?></label><br />
<input id="modlgn_passwd" type="password" name="passwd" class="inputbox" size="18" alt="password" />
</p>
<?php if(JPluginHelper::isEnabled('system', 'remember')) : ?>
<p id="form-login-remember">
<input type="checkbox" name="remember" class="checkbox" value="yes" alt="<?php echo JText::_('Remember me'); ?>" />
<label class="remember">
<?php echo JText::_('Remember me'); ?>
</label>
</p>
<?php endif; ?>
<div class="readon"><input type="submit" name="Submit" class="button" value="<?php echo JText::_('LOGIN') ?>" /></div>
</fieldset>
<ul>
<li>
<a href="<?php echo JRoute::_( 'index.php?option=com_user&view=reset' ); ?>">
<?php echo JText::_('FORGOT_YOUR_PASSWORD'); ?></a>
</li>
<li>
<a href="<?php echo JRoute::_( 'index.php?option=com_user&view=remind' ); ?>">
<?php echo JText::_('FORGOT_YOUR_USERNAME'); ?></a>
</li>
<?php
$usersConfig = &JComponentHelper::getParams( 'com_users' );
if ($usersConfig->get('allowUserRegistration')) : ?>
<li>
<a href="<?php echo JRoute::_( 'index.php?option=com_user&view=register' ); ?>">
<?php echo JText::_('REGISTER'); ?></a>
</li>
<?php endif; ?>
</ul>
<?php echo $params->get('posttext'); ?>
<input type="hidden" name="option" value="com_user" />
<input type="hidden" name="task" value="login" />
<input type="hidden" name="return" value="<?php echo $return; ?>" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
<?php endif; ?>
Take a look at JFusion. It was written specifically to handle single sign on/login/registration for Joomla and many other popular projects. Here is the WP specific info -
http://www.jfusion.org/docs/doku.php?id=start#wordpress_3

Wordpress Comment Pagination

Here is a post with 12 comments :
http://test1.zomghentai.com/kateikyoushi-no-onee-san-2-h-no-hensachi-agechaimasu-episode-1
In my wordpress Discussion Settings, I have set it to
"Break Comments into Pages with 5 comments each"
As you can see, at the bottom of comments I have links to Page 1, 2, and 3.
The problem?
1) Page 1 (default page) is showing all 12 comments at once, instead of showing just 5
and
2) Page 2, and 3, are all the same as Page 1
My comments.php file is as followed :
<div id="comments">
<?php // Do not delete these lines
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?>
<h3>This post is password protected. Enter the password to view comments.</h3>
<?php
return;
}
}
/* This variable is for alternating comment background */
$oddcomment = 'alt';
?>
<?php if ($comments) : ?>
<span style="font-size: 13px;"><strong>Comments</strong></span>
<ul>
<?php foreach ($comments as $comment) : ?>
<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
<div class="cauthor"><strong><?php comment_author_link() ?></strong> says on <?php comment_date('M jS, Y') ?> at <?php comment_time() ?><?php if ($comment->comment_approved == '0') : ?> (Your comment is awaiting moderation)<?php endif; ?></div>
<div class="cbox">
<?php comment_text() ?>
</div>
<div style="clear: both;"></div>
</li>
<?php /* Changes every other comment to a different class */
if ('alt' == $oddcomment) $oddcomment = '';
else $oddcomment = 'alt';
?>
<?php endforeach; /* end for each comment */ ?>
</ul>
<?php paginate_comments_links() ?>
<?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post-> comment_status) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p>Comments are closed.</p>
<?php endif; ?>
<?php endif; ?>
<?php if ('open' == $post-> comment_status) : ?>
<div class="postinput">
<span style="font-size: 13px;padding: 10px 0 0 0;"><strong>Leave a Comment</strong></span>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be logged in to post a comment.</p>
<?php else : ?>
<form action="http://www.hentaidreaming.com/wp-comments-post.php" method="post" id="commentform">
<?php if ( $user_ID ) : ?>
<p>Logged in as <?php echo $user_identity; ?>. Logout »</p>
<?php else : ?>
<p>
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="20" tabindex="1" />
<label for="author"><small>Name <?php if ($req) _e('<strong>(required)</strong>'); ?></small></label>
</p>
<p>
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="20" tabindex="2" />
<label for="email"><small>Mail <?php if ($req) _e('<strong>(required, will not be published)</strong>'); ?></small></label>
</p>
<?php endif; ?>
<p>
<textarea name="comment" id="comment" tabindex="4" rows="10" cols="50" ></textarea>
</p>
<p>
<input name="submit" type="image" id="submit" class="input-submit" tabindex="5" value="Submit Comment" title="Please review your comment before submitting" alt="Submit Comment" src="http://www.hentaidreaming.com/wp-content/themes/hdreamwp/images/submit.gif" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</p>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>
</div> <!-- End "postinput" -->
</div> <!-- End "comments" -->
paginate_comments_links()
This is what you should have posted, what you posted tells nothing.

WordPress 'comment is awaiting moderation.' message not appearing when a comment is submitted?

Everything is pretty standard from WP samples, with minor modifications. But when a comment is submitted, it does not show the "your comment is awaiting moderation" message.
The comments.php:
<div id="comment-block">
<h4><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h4>
<ul id="commentlist">
<?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
</ul>
<?php // this is displayed if there are no comments so far ?>
<?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments">Comments are closed.</p>
<?php endif; ?>
<?php if ('open' == $post->comment_status) : ?>
<h4>Leave a reply</h4>
<div class="cancel-comment-reply">
<small><?php cancel_comment_reply_link(); ?></small>
</div>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be logged in to post a comment.</p>
<?php else : ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if ( $user_ID ) : ?>
<p class="loggedIn">Logged in as <?php echo $user_identity; ?>. Log out »</p>
<?php else : ?>
<table width="675" cellpadding="0" cellspacing="0" border="0">
<tr><td style="padding-right: 20px;"><label for="author">Name <?php if ($req) echo "(required)"; ?></label></td>
<td style="padding-right: 20px;"><label for="email">Email <?php if ($req) echo "(required)"; ?></label> <small>(will not be published)</small></td>
<td><label for="url">Website <?php if ($req) echo "(required)"; ?></label></td>
</tr>
<tr><td style="padding-right: 20px;"><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" class="text" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> /></td>
<td style="padding-right: 20px;"><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" class="text" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> /></td>
<td><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" class="text" tabindex="3" /></td>
</tr>
</table>
<?php endif; ?>
<label for="comment">Comment <?php if ($req) echo "(required)"; ?></label><br />
<textarea name="comment" id="comment" rows="10" tabindex="4" class="text"></textarea>
<input name="submit" type="image" src="<?php bloginfo('template_directory'); ?>/images/submit_button.png" width="130" height="24" alt="Submit" id="submit" tabindex="5" />
<?php comment_id_fields(); ?>
<?php do_action('comment_form', $post->ID); ?>
</form>
<div class="clear"></div>
<?php endif; // If registration required and not logged in ?>
</div>
<?php endif; // if you delete this the sky will fall on your head ?>
And the mytheme_comments function in functions.php
function mytheme_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<div id="comment-<?php comment_ID(); ?>">
<span class="comment-author vcard">
<?php printf(__('<cite class="fn">%s</cite> <span class="says">says at</span>'), get_comment_author_link()) ?>
</span>
<?php if ($comment->comment_approved == '0') : ?>
<em><?php _e('Your comment is awaiting moderation.') ?></em>
<br />
<?php endif; ?>
<span class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
<?php printf(__('%2$s, %1$s'), get_comment_date(), get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),' ','') ?></span>
<?php comment_text() ?>
<div class="reply">
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
</div>
<?php
}
?>
my English is poor !
i have got the solution if you can try !
this problem generally related to actual domain with hosted site
eg.
<1>if your site hosted on "anotherdomainsite.com"
and your domain is "yoursite.com" then this problem will occur !
you can try to change your actual domain ! which is actually hosted your site!
means both hosted & domain should be same !
<2> thing you can try
submit a comment on your site
when you are done
replace the actual hosted domain instead of pointed domain
eg.
http://yoursite.com/yourposturl/#comment-265
place anotherdomainsite.com instead of yoursite.com

Resources