WordPress.org

Ready to get started?Download WordPress

Forums

Remove field in comment reply form (10 posts)

  1. Carolyn
    Member
    Posted 10 months ago #

    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;}

  2. WPyogi
    Volunteer Moderator
    Posted 10 months ago #

    Without seeing what you are talking about, no way to help.

  3. Carolyn
    Member
    Posted 10 months ago #

    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.

  4. WPyogi
    Volunteer Moderator
    Posted 10 months ago #

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

  5. Carolyn
    Member
    Posted 10 months ago #

    Made theme. site link

  6. WPyogi
    Volunteer Moderator
    Posted 10 months ago #

    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;
    }
  7. Carolyn
    Member
    Posted 10 months ago #

    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

  8. WPyogi
    Volunteer Moderator
    Posted 10 months ago #

    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 -

    http://jobs.wordpress.net/

  9. allyouneedislists
    Member
    Posted 8 months ago #

    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?

  10. alchymyth
    Forum Moderator
    Posted 8 months ago #

    @allyouneedislists

    please start your own topic -

    http://codex.wordpress.org/Forum_Welcome#Where_To_Post

Reply

You must log in to post.

About this Topic