• This is a great plugin. But I will like to disanle disclaimer message from my pages, I want the disclaimer message to show on posts only.
    Please reply.

    Thanks.

Viewing 1 replies (of 1 total)
  • Plugin Author Collins Agbonghama

    (@collizo4sky)

    Edit dm-meta-box.php file. replace the function name dispay_disclaimer_text with the code below

    function dispay_disclaimer_text( $content ) {
    		global $post;
    
    		if ( is_singular( 'page' ) ) {
    			return $content;
    		}
    
    		$plugin_db_options = get_option( 'dm_disclaimer_manager' );
    
    		// get formatted disclaimer text
    		$disclaimer_text = self::formatted_disclaimer_text();
    
    		$disclaimer_position = $plugin_db_options['disclaimer_position'];
    
    		$authors_with_disclaimers = $plugin_db_options['author_with_disclaimer'];
    
    		if ( in_array( get_the_author_meta( 'user_login' ), $authors_with_disclaimers ) ) {
    
    			if ( $disclaimer_position == 'top' ) {
    
    				$content = $disclaimer_text . $content;
    			}
    			elseif ( $disclaimer_position == 'middle' ) {
    				$para_content = explode( '</p>', $content );
    				$halfway_mark = ceil( count( $para_content ) / 2 );
    
    				$first_half_content  = implode( '</p> ', array_slice( $para_content, 0, $halfway_mark ) );
    				$second_half_content = implode( '</p> ', array_slice( $para_content, $halfway_mark ) );
    
    				$content = $first_half_content . $disclaimer_text . $second_half_content;
    			}
    			elseif ( $disclaimer_position == 'bottom' ) {
    				$content .= $disclaimer_text;
    
    			}
    		}
    
    		return $content;
    
    	}
Viewing 1 replies (of 1 total)
  • The topic ‘Disable disclaimer for pages’ is closed to new replies.