• Carolyn

    (@carolynbabykaica)


    Hello
    I’m trying to remove a comment field from the reply form only on posts. Been trying to use CSS to display:none for the field in CSS but it won’t remove it for the reply only.

    Please help!
    ol.comment-list ul.children .comment-rating-label, ol.comment-list ul.children .comment-rating {display:none;}

Viewing 9 replies - 1 through 9 (of 9 total)
  • Without seeing what you are talking about, no way to help.

    Thread Starter Carolyn

    (@carolynbabykaica)

    Here’s the function.

    // Add fields after default fields above the comment box, always visible
    add_action( 'comment_form_logged_in_after', 'additional_fields' );
    add_action( 'comment_form_after_fields', 'additional_fields' );
    
    function additional_fields () {
    
    	global $post, $oswcPostTypes;
    	$meta = get_post_meta($post->ID, "user_rating", $single = true);
    	//get the review type
    	$postTypeId = get_post_type($post->ID);
    	$reviewType = $oswcPostTypes->get_type_by_id($postTypeId);
    	$rating_type = $reviewType->rating_type;
    	$userRatingsEnabled = $reviewType->user_ratings_enabled;
    	if($userRatingsEnabled) {
    		//get the ip address
    		$ip=$_SERVER['REMOTE_ADDR'];
    		if(strpos($meta,$ip) === false) {
    		$comments = get_comments($post->ID);
       			if ($comment->comment_parent==0) {
    
    			echo '<div class="comment_rating_label label"><label for="rating">'. __('My Rating','made') . '</label></div>';
    
    			echo '<div class="comment_rating"><select id="rating" name="rating"><option value="">---------</option>';
    
    			switch ($rating_type) {
    				case "stars":
    					for( $i=5; $i >= 0; $i-=.5 )
    						echo '<option value="'. $i .'"/>'. $i .'</option>';
    					break;
    				case "number":
    					for( $i=10; $i >= 1; $i-=1 )
    						echo '<option value="'. $i .'"/>'. $i .'</option>';
    					break;
    				case "percentage":
    					for( $i=100; $i >= 0; $i-=1 )
    						echo '<option value="'. $i .'"/>'. $i .'</option>';
    					break;
    				case "letter":
    					echo '<option value="A+"/>A+</option>';
    					echo '<option value="A"/>A</option>';
    					echo '<option value="A-"/>A-</option>';
    					echo '<option value="B+"/>B+</option>';
    					echo '<option value="B"/>B</option>';
    					echo '<option value="B-"/>B-</option>';
    					echo '<option value="C+"/>C+</option>';
    					echo '<option value="C"/>C</option>';
    					echo '<option value="C-"/>C-</option>';
    					echo '<option value="D+"/>D+</option>';
    					echo '<option value="D"/>D</option>';
    					echo '<option value="D-"/>D-</option>';
    					echo '<option value="F+"/>F+</option>';
    					echo '<option value="F"/>F</option>';
    					break;
    			}
    			}
    
    			echo '</select></div><br class="clearer" />';
    
    		}
    	}
    }

    Trying to hide the comment_rating and comment_rating_label.

    What theme or plugin is this from? A link to the site would be relevant as well.

    Thread Starter Carolyn

    (@carolynbabykaica)

    Made theme. site link

    For help modifying the function, you’ll need to ask the developers of the the theme – since that’s not a theme supported here (we don’t support commercial themes).

    But it looks like you can hide those elements using this in your custom CSS:

    div.comment_rating_label, div.comment_rating {
       display: none;
    }

    Thread Starter Carolyn

    (@carolynbabykaica)

    Thanks. That just removed the label and rating for all comments not just on reply comments.

    I have talked with the theme developer but as this is outside of “support” I can’t ask him to spend so much time on trying to solve the answer.

    Thanks

    You can see if there’s any CSS class or id assigned to a reply comment – and try adding that to the CSS I posted above. Since we don’t support commercial themes here, I’m afraid that’s outside the scope of these forums too.

    You could consider hiring someone to help you with this –

    https://jobs.wordpress.net/

    seems a bit easy just to dismiss it as being a commercial theme.

    I have pretty much the same question and for the sake of argument let’s just assume that I would like to exclude the “URL” field from the reply form.

    So there are two situations:

    1. Post a new comment, with fields to fill out:
    – name
    – email address
    – URL

    2. post a reply to a comment, with fields to fill out:
    – name
    – email address

    This means that the URL field should only be removed when you post a Reply, not a comment.

    Is this possible?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Remove field in comment reply form’ is closed to new replies.