【问题标题】:How to delete div class from php?如何从 php 中删除 div 类?
【发布时间】:2021-06-24 16:13:02
【问题描述】:

我想从名为 Front-End-Pm 的插件中删除 div class="fep-avatar-more-60"。

我在插件上搜索了该类,这是我找到的:

http://prntscr.com/16ma5t1

我试图通过 css 禁用它,但它仍然破坏了设计,是否有通过 php 删除该类?或者更好的是使用子主题中的模板将其删除?

提前致谢

1- 类 fep-messages.php :

<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

//Message CLASS
class Fep_Messages {
    private static $instance;

    public static function init() {
        if ( ! self::$instance instanceof self ) {
            self::$instance = new self;
        }
        return self::$instance;
    }

    function actions_filters() {
        add_action( 'fep_action_validate_form', array( $this, 'time_delay_check' ), 10, 2 );
        add_action( 'fep_action_validate_form', array( $this, 'box_full_check' ), 10, 2 );
        add_action( 'fep_posted_bulk_bulk_action', array( $this, 'bulk_action' ) );
    }

    function time_delay_check( $where, $errors ) {
        if ( ! in_array( $where, [ 'newmessage', 'shortcode-newmessage' ] ) ) {
            return;
        }
        $delay = absint( fep_get_option( 'time_delay', 5 ) );
        if ( fep_is_user_admin() || ! $delay ) {
            return;
        }
        $args = array(
            'mgs_type'      => 'message',
            'mgs_author'    => get_current_user_id(),
            'created_after' => date( 'Y-m-d H:i:s', strtotime( "-{$delay} minutes" ) ),
            'fields'        => array( 'mgs_id' ),
            'per_page'      => 1,
        );
        if ( 'threaded' == fep_get_message_view() ) {
            $args['mgs_parent'] = 0;
        }
        if ( fep_get_messages( $args ) ) {
            $errors->add( 'time_delay', sprintf( __( 'Please wait at least %s between messages.', 'front-end-pm' ), sprintf( _n( '%s minute', '%s minutes', $delay, 'front-end-pm' ), number_format_i18n( $delay ) ) ) );
        }
    }

    function box_full_check( $where, $errors ) {
        if ( ! in_array( $where, [ 'newmessage', 'shortcode-newmessage' ] ) ) {
            return;
        }
        if ( ! $max = fep_get_current_user_max_message_number() ) {
            return;
        }
        if ( fep_get_user_message_count( 'total' ) >= $max ) {
            $errors->add( 'MgsBoxFull', __( 'Your message box is full. Please delete some messages.', 'front-end-pm' ) );
        }
    }

    function user_message_count( $value = 'all', $force = false, $user_id = false ) {
        if ( ! $user_id ) {
            $user_id = get_current_user_id();
        }
        if ( 'show-all' == $value ) {
            $value = 'total';
        }
        if ( ! $user_id ) {
            if ( 'all' == $value ) {
                return array();
            } else {
                return 0;
            }
        }
        $user_meta = get_user_meta( $user_id, '_fep_user_message_count', true );
        if ( false === $user_meta || $force || ! isset( $user_meta['total'] ) || ! isset( $user_meta['unread'] ) ) {
            $args = array(
                'mgs_type'      => 'message',
                'mgs_status'    => 'publish',
                'per_page'      => 0,
                'fields'        => 'COUNT(*)',
                'orderby'       => false,
            );
            if ( 'threaded' == fep_get_message_view() ) {
                $args['mgs_parent'] = 0;
            }
            $args = apply_filters( 'fep_message_count_query_args', $args, $user_id );
            
            $total_args = $args;
            $total_args['participant_query'][] = array(
                'mgs_participant' => $user_id,
                'mgs_deleted' => false,
            );
            
            $unread_args = $args;
            $unread_args['participant_query'][] = array(
                'mgs_participant' => $user_id,
                'mgs_parent_read' => false,
                'mgs_deleted' => false,
            );
            
            $user_meta = array(
                'total'     => fep_get_messages( $total_args ),
                'unread'    => fep_get_messages( $unread_args ),
            );
            update_user_meta( $user_id, '_fep_user_message_count', $user_meta );
        }
        if ( isset( $user_meta[$value] ) ) {
            return $user_meta[$value];
        }
        if ( 'all' == $value ) {
            return $user_meta;
        } else {
            return 0;
        }
    }

    function user_messages( $action = 'messagebox', $user_id = false ) {
        if ( ! $user_id ) {
            $user_id = get_current_user_id();
        }
        $filter = ! empty( $_GET['fep-filter'] ) ? $_GET['fep-filter'] : '';
        $args = array(
            'mgs_type'      => 'message',
            'mgs_status'    => 'publish',
            'per_page'      => fep_get_option( 'messages_page', 15 ),
            'paged'         => ! empty( $_GET['feppage'] ) ? absint( $_GET['feppage'] ): 1,
            'check_more_row' => true,
            'count_total'    => false,
        );
        if ( 'threaded' == fep_get_message_view() ) {
            $args['mgs_parent'] = 0;
            $args['orderby'] = 'mgs_last_reply_time';
        } else {
            $args['orderby'] = 'mgs_created';
        }
        if ( ! empty( $_GET['fep-search'] ) ) {
            $args['s'] = $_GET['fep-search'];
        }
        switch ( $filter ) {
            case 'inbox':
                if ( 'threaded' == fep_get_message_view() ) {
                    $args['mgs_last_reply_by_not_in'] = [ $user_id ];
                } else {
                    $args['mgs_author_not_in'] = [ $user_id ];
                }
                $args['participant_query'][] = array(
                    'mgs_participant' => $user_id,
                    'mgs_deleted' => false,
                );
                break;
            case 'sent':
                if ( 'threaded' == fep_get_message_view() ) {
                    $args['mgs_last_reply_by'] = $user_id;
                } else {
                    $args['mgs_author'] = $user_id;
                }
                $args['participant_query'][] = array(
                    'mgs_participant' => $user_id,
                    'mgs_deleted' => false,
                );
                break;
            case 'archive':
                $args['participant_query'][] = array(
                    'mgs_participant' => $user_id,
                    'mgs_deleted' => false,
                    'mgs_archived' => true,
                );
                break;
            case 'read':
                $args['participant_query'][] = array(
                    'mgs_participant' => $user_id,
                    'mgs_deleted' => false,
                    'mgs_parent_read' => true,
                );
                break;
            case 'unread':
                $args['participant_query'][] = array(
                    'mgs_participant' => $user_id,
                    'mgs_deleted' => false,
                    'mgs_parent_read' => false,
                );
                break;
            default:
                $args['participant_query'][] = array(
                    'mgs_participant' => $user_id,
                    'mgs_deleted' => false,
                    'mgs_archived' => false,
                );
                $args = apply_filters( 'fep_message_query_args_' . $filter, $args, $user_id );
                break;
        }
        $args = apply_filters( 'fep_message_query_args', $args, $user_id );
        
        $query = new FEP_Message_Query( $args );
        
        return $query;
    }
    
    function get_message_with_replies( $id ) {
        $args = array(
            'mgs_type'      => 'message',
            'mgs_status'    => 'publish',
            'mgs_id'        => $id,
            'per_page'      => 0,
            'orderby'       =>'mgs_created',
            'order'         => 'ASC',
            'count_total'   => false,
        );
        if ( 'threaded' == fep_get_message_view() ) {
            $args['include_child'] = true;
        }
        $args = apply_filters( 'fep_filter_get_message_with_replies', $args );
        return new FEP_Message_Query( $args );
    }

    function bulk_action( $action, $ids = null ) {
        if ( null === $ids ) {
            $ids = ! empty( $_POST['fep-message-cb'] ) ? $_POST['fep-message-cb'] : array();
        }
        if ( ! $action || ! $ids || ! is_array( $ids ) ) {
            return;
        }
        $count = 0;
        foreach( $ids as $id ) {
            if ( $this->bulk_individual_action( $action, absint( $id ) ) ) {
                $count++;
            }
        }
        $message = '';
        if ( $count ) {
            delete_user_meta( get_current_user_id(), '_fep_user_message_count' );
            switch ( $action ) {
                case 'delete':
                    $message = sprintf( _n( '%s message successfully deleted.', '%s messages successfully deleted.', $count, 'front-end-pm' ), number_format_i18n( $count ) );
                    break;
                case 'mark-as-read':
                    $message = sprintf( _n( '%s message successfully marked as read.', '%s messages successfully marked as read.', $count, 'front-end-pm' ), number_format_i18n( $count ) );
                    break;
                case 'mark-as-unread':
                    $message = sprintf( _n( '%s message successfully marked as unread.', '%s messages successfully marked as unread.', $count, 'front-end-pm' ), number_format_i18n( $count ) );
                    break;
                case 'archive':
                    $message = sprintf( _n( '%s message successfully archived.', '%s messages successfully archived.', $count, 'front-end-pm' ), number_format_i18n( $count ) );
                    break;
                case 'restore':
                    $message = sprintf( _n( '%s message successfully restored.', '%s messages successfully restored.', $count, 'front-end-pm' ), number_format_i18n( $count ) );
                    break;
            }
            //$message = '<div class="fep-success">' . $message . '</div>';
        }
        $message = apply_filters( 'fep_message_bulk_action_message', $message, $count );
        if ( $message ) {
            fep_success()->add( 'success', $message );
        }
    }

    function bulk_individual_action( $action, $id ) {
        $return = false;
        
        switch ( $action ) {
            case 'delete':
                $return = fep_delete_message( $id );
                break;
            case 'mark-as-read':
                if ( fep_current_user_can( 'view_message', $id ) ) {
                    $return = fep_make_read( true, $id);
                }
                break;
            case 'mark-as-unread':
                if ( fep_current_user_can( 'view_message', $id ) ) {
                    $return = FEP_Participants::init()->unmark( $id, get_current_user_id(), [ 'parent_read' => true ] );
                }
                break;
            case 'archive':
                if ( fep_current_user_can( 'view_message', $id ) ) {
                    $return = FEP_Participants::init()->mark( $id, get_current_user_id(), ['archive' => true ] );
                }
                break;
            case 'restore':
                if ( fep_current_user_can( 'view_message', $id ) ) {
                    $return = FEP_Participants::init()->unmark( $id, get_current_user_id(), [ 'archive' => true ] );
                }
                break;
            default:
                $return = apply_filters( 'fep_message_bulk_individual_action', false, $action, $id, $id ); //second $id for back-word compatability
                break;
        }
        return $return;
    }

    function get_table_bulk_actions() {
        $filter = ! empty( $_GET['fep-filter'] ) ? $_GET['fep-filter'] : '';
        $actions = array(
            'delete'        => __( 'Delete', 'front-end-pm' ),
            'mark-as-read'  => __( 'Mark as read', 'front-end-pm' ),
            'mark-as-unread'=> __( 'Mark as unread', 'front-end-pm' ),
        );
        if ( 'archive' == $filter ) {
            $actions['restore'] = __( 'Restore', 'front-end-pm' );
        } else {
            $actions['archive'] = __( 'Archive', 'front-end-pm' );
        }
        return apply_filters( 'fep_message_table_bulk_actions', $actions );
    }

    function get_table_filters() {
        $filters = array(
            'show-all'  => __( 'Show all', 'front-end-pm' ),
            'inbox'     => __( 'Inbox', 'front-end-pm ' ),
            'sent'      => __( 'Sent', 'front-end-pm' ),
            'read'      => __( 'Read', 'front-end-pm' ),
            'unread'    => __( 'Unread', 'front-end-pm' ),
            'archive'   => __( 'Archive', 'front-end-pm' ),
        );
        return apply_filters( 'fep_message_table_filters', $filters );
    }

    function get_table_columns() {
        $columns = array(
            'fep-cb'    => __( 'Checkbox', 'front-end-pm' ),
            'avatar'    => __( 'Avatar', 'front-end-pm' ),
            'author'    => __( 'Author', 'front-end-pm' ),
            'title'     => __( 'Title', 'front-end-pm' ),
        );
        return apply_filters( 'fep_message_table_columns', $columns );
    }

    function get_column_content( $column ) {
        switch ( $column ) {
            case has_action( "fep_message_table_column_content_{$column}" ):
                do_action( "fep_message_table_column_content_{$column}" );
                break;
            case 'fep-cb':
                ?><input type="checkbox" class="fep-cb" name="fep-message-cb[]" value="<?php echo fep_get_the_id(); ?>" /><?php
                break;
            case 'avatar':
                if( $group = apply_filters( 'fep_is_group_message', false, fep_get_the_id() ) ){
                    ?><div class="fep-avatar-p fep-avatar-p-90"><?php
                    echo '<div class="fep-avatar-group-60" title="' . esc_attr( $group ) . '"></div>';
                    echo '</div>';
                } else {
                    $participants = fep_get_participants( fep_get_the_id() );
                    if ( apply_filters( 'fep_remove_own_avatar_from_messagebox', false )
                         && ( $key = array_search( get_current_user_id(), $participants ) ) !== false ) {
                        unset( $participants[$key] );
                    }
                    $count = 1;
                    ?>
                    <div class="fep-avatar-p <?php echo ( count( $participants ) > 2 ) ? 'fep-avatar-p-120': 'fep-avatar-p-90' ?>"><?php
                    foreach( $participants as $p ) {
                        if ( $count > 2 ) {
                            echo '<div class="fep-avatar-more-60" title="' . __( 'More users', 'front-end-pm' ) . '"></div>';
                            break;
                        } 
                        ?><div class="fep-avatar-<?php echo $count; ?>"><?php echo get_avatar( $p, 60, '', fep_user_name( $p ), array( 'extra_attr'=> 'title="' . esc_attr( fep_user_name( $p ) ) . '"' ) ); ?></div><?php
                        $count++;
                    }
                    echo '</div>';
                }
                break;
            case 'author':
                if( 'threaded' === fep_get_message_view() ){
                    ?><span class="fep-message-author"><?php echo fep_user_name( fep_get_message_field( 'mgs_last_reply_by' ) ); ?></span><span class="fep-message-date"><?php echo fep_get_the_date( 'mgs_last_reply_time' ); ?></span><?php
                } else {
                    ?><span class="fep-message-author"><?php echo fep_user_name( fep_get_message_field( 'mgs_author' ) ); ?></span><span class="fep-message-date"><?php echo fep_get_the_date( 'created' ); ?></span><?php
                }
                break;
            case 'title':
                if ( ! fep_is_read( true ) ) {
                    $span = '<span class="fep-unread-classp"><span class="fep-unread-class">' . __( 'Unread', 'front-end-pm' ) . '</span></span>';
                    $class = ' fep-strong';
                } else {
                    $span = '';
                    $class = '';
                } 
                ?><span class="<?php echo $class; ?>"><a href="<?php echo fep_query_url( 'viewmessage', [
                    'fep_id' => fep_get_the_id(),
                    'feppage' => isset( $_GET['feppage'] ) ? $_GET['feppage'] : 1,
                    'fep-filter' => isset( $_GET['fep-filter'] ) ? $_GET['fep-filter'] : '',
                    ] ); ?>"><?php echo fep_get_the_title(); ?></a></span><?php echo $span; ?>
                <div class="fep-message-excerpt">
                    <?php echo fep_get_the_excerpt(); ?>
                </div><?php
                break;
            default:
                do_action( 'fep_message_table_column_content', $column );
                break;
        }
    }
} //END CLASS

add_action( 'wp_loaded', array( Fep_Messages::init(), 'actions_filters' ) );

2 - 查看消息头.php:

<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

$messages_heads = Fep_Messages::init()->user_messages();

if ( $messages_heads->have_messages() ) {
    while ( $messages_heads->have_messages() ) {
        $messages_heads->the_message();
        ?>
        <div id="fep-message-head-<?php echo fep_get_the_id(); ?>" class="fep-message-head<?php echo ( isset( $_GET['fep_id'] ) && absint( $_GET['fep_id'] ) === fep_get_the_id() ) ? ' fep-message-head-active' : ''; ?>" data-fep_id="<?php echo fep_get_the_id(); ?>">
        <?php
        if ( $group = apply_filters( 'fep_is_group_message', false, fep_get_the_id() ) ) {
            ?>
            <div class="fep-avatar-p fep-avatar-p-90">
                <div class="fep-avatar-group-60" title="<?php echo esc_attr( $group ); ?>"></div>
            </div>
            <?php
        } else {
            $participants = fep_get_participants( fep_get_the_id() );
            if ( apply_filters( 'fep_remove_own_avatar_from_messagebox', false )
                 && ( $key = array_search( get_current_user_id(), $participants ) ) !== false ) {
                unset( $participants[ $key ] );
            }
            $count = 1;
            ?>
            <div class="fep-avatar-p <?php echo ( count( $participants ) > 2 ) ? 'fep-avatar-p-120' : 'fep-avatar-p-90' ?>">
            <?php
            foreach ( $participants as $p ) {
                if ( $count > 2 ) {
                    echo '<div class="fep-avatar-more-60" title="' . __( 'More users', 'front-end-pm' ) . '"></div>';
                    break;
                }
                ?>
                <div class="fep-avatar-<?php echo $count; ?>"><?php echo get_avatar( $p, 60, '', fep_user_name( $p ), array( 'extra_attr' => 'title="' . esc_attr( fep_user_name( $p ) ) . '"' ) ); ?></div>
                <?php
                $count++;
            }
            echo '</div>';
        }
        ?></div><?php
    }
    echo fep_pagination_prev_next( $messages_heads->has_more_row );
} else {
    echo '<div class="fep-error">' . esc_html__( 'No messages found. Try different filter.', 'front-end-pm' ) . '</div>';
}

这是css文件:

/*The main wrapper*/
#fep-wrapper {
    margin: 5px;
    position: relative;
}

/*Header styling*/
#fep-header {
    border: 1px solid #e7e7e7;
    /* color: #000000; */
    width: 100%;
}

#fep-header strong {
    /* color: #333333; */
    font-size: 20px;
}

#fep-header .avatar {
    border: none;
    display: inline-block;
    margin: 5px;
    padding: 0;
    vertical-align: top;
}

/*Content styling*/
#fep-content {
    /* color: #000000; */
    border: 1px solid #e7e7e7;
    height: auto;
    margin-bottom: 10px;
    margin-top: 10px;
    overflow: auto;
    padding: 5px;
    width: 100%;
}

#fep-content p, #fep-content form {
    margin: 5px;
}

#fep-content hr {
    margin-bottom: 5px;
    margin-top: 5px;
}

#fep-content a {
    /* color: navy; */
    text-decoration: underline;
}

#fep-content .avatar {
    -moz-border-radius: 50%;
    -webkit-border-radius: 50%;
    border-radius: 50%;
}

/*Footer styling*/
#fep-footer {
    border: 1px solid #e7e7e7;
    /* color: #333333; */
    font-size: 10px;
    text-align: center;
    width: 100%;
}

#fep-footer a,
#fep-footer a:hover,
#fep-footer a:visited {
    /* color: #333333; */
    text-decoration: underline;
}

/*Auto-suggest*/
#fep-result {
    background: #d3eef5;
    border: solid 1px #333333;
    display: none;
    position: absolute;
    width: 250px;
}

#fep-result ul,
#fep-result li {
    border: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

#fep-result li {
    border-top: solid 1px #333333;
}

#fep-result li a {
    color: #333333;
    display: block;
    font-weight: normal;
    padding: 5px;
    text-decoration: none;
}

#fep-result li a:hover {
    background: #333333;
    color: white;
}

.fep-table {
    border-collapse: collapse;
    display: table;
    width: 100%;
}

.fep-table > div {
    display: table-row;
}

.fep-table > div > div {
    display: table-cell;
}

.fep-table .fep-table-caption {
    display: table-caption;
    font-weight: bold;
    text-align: center;
}

.fep-action-table {
    margin-bottom: 10px;
}

.fep-action-table > div > div {
    width: 25%;
}

.fep-action-table select {
    margin-top: 10px;
}

.fep-table .fep-column-avatar,
.fep-table .fep-column-fep-cb {
    padding-right: 10px;
    vertical-align: middle;
}

.fep-table .fep-column-author,
.fep-table .fep-column-date {
    min-width: 150px;
}

.fep-table .fep-message-date {
    display:block;
    font-size: 70%;
}

.fep-table .fep-message-excerpt {
    opacity:0.3;
}

.fep-unread-classp {
    position:relative; 
}

.fep-unread-class {
    background-color: red; /* you could use a background image if you'd like as well */
    border-radius: 30px;
    box-shadow: 1px 1px 1px gray;
    color: white;
    font-size: 9px;
    font-weight: bold;
    height: 16px;
    line-height: 16px;
    padding: 0 1px;
    position: absolute; /* This breaks the div from the normal HTML document. */
    top: -6px;
}

.fep-message-toggle-all {
    cursor: pointer;
}

.fep-align-left {
    text-align: left;
}

.fep-align-right {
    text-align: right;
}

.fep-align-centre {
    text-align: center;
}

.fep-hd {
    display:none;
}

.fep-strong {
    font-weight: bold;
}

.fep-pagination {
    display: inline-block;
    padding-left: 0;
    margin: 20px 0;
    border-radius: 6px;
}

.fep-pagination > li {
    display: inline;
}

.fep-pagination > li > a,
.fep-pagination > li > span {
    background-color: #ffffff;
    border: 1px solid #dddddd;
    color: #337ab7;
    float: left;
    font-size: 12px;
    line-height: 1.42857143;
    margin-left: -1px;
    padding: 7px 12px;
    position: relative;
    text-decoration: none;
}

.fep-pagination > li:first-child > a,
.fep-pagination > li:first-child > span {
    margin-left: 0;
    border-bottom-left-radius: 3px;
    border-top-left-radius: 3px;
}

.fep-pagination > li:last-child > a,
.fep-pagination > li:last-child > span {
    border-bottom-right-radius: 3px;
    border-top-right-radius: 3px;
}

.fep-pagination > li > a:hover,
.fep-pagination > li > span:hover,
.fep-pagination > li > a:focus,
.fep-pagination >li > span:focus {
    background-color: #eeeeee;
    border-color: #dddddd;
    color: #23527c;
}

.fep-pagination > .active > a,
.fep-pagination > .active > span,
.fep-pagination > .active > a:hover,
.fep-pagination > .active > span:hover,
.fep-pagination > .active > a:focus,
.fep-pagination > .active > span:focus {
    background-color: #337ab7;
    border-color: #337ab7;
    color: #ffffff;
    cursor: default;
    z-index: 2;
}

.fep-pagination > .disabled > span,
.fep-pagination > .disabled > span:hover,
.fep-pagination > .disabled > span:focus,
.fep-pagination > .disabled > a,
.fep-pagination > .disabled > a:hover,
.fep-pagination > .disabled > a:focus {
    background-color: #ffffff;
    border-color: #dddddd;
    color: #777777;
    cursor: not-allowed;
}

#fep-message-top.fep-loading-gif,
.fep-loading-gif {
    background: url('../images/loading.gif') no-repeat right center;
    padding-right: 16px;
}

.fep-message .fep-message-title-heading,
.fep-per-message .fep-message-title {
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    /* background-color: #f2f7fc; */
    border-radius: 10px;
    border: 1px solid #e7e7e7;
    box-sizing: border-box;
    font-weight: bold;
    margin-bottom: 5px;
    padding: 10px;
    width: 100%;
}

.fep-message .fep-message-title-heading {
    font-size: 20px;
}

.fep-message .fep-message-title-heading .fep_block_unblock_user {
    font-size: 16px;
    font-weight: normal;
}

.fep-per-message .fep-message-title {
    cursor: pointer;
    font-size: 16px;
}

.fep-per-message {
    border: 1px solid #e7e7e7;
    margin: 5px;
    padding: 5px;
}

.fep-per-message .fep-message-title .date {
    font-size: 12px;
    font-weight: normal;
    padding-left: 10px;
    text-align: right;
}

.fep-per-message .fep-message-title {
    display: flex;
    justify-content: space-between;
}

.fep-avatar-p {
    height: 60px;
    position: relative;
}

.fep-avatar-p-120 {
    min-width: 120px;
}

.fep-avatar-p-90 {
    min-width: 90px;
}

.fep-avatar-p .fep-avatar-1,
.fep-avatar-p .fep-avatar-2,
.fep-avatar-more-60,
.fep-avatar-group-60 {
    height: 60px;
    width: 60px;
}

.fep-avatar-p .fep-avatar-2 {
    left: 30px;
    position: absolute;
    top: 0;
}

.fep-avatar-more-60 {
    background: url('../images/avatar-more-60.png') no-repeat 0 0;
}

.fep-avatar-group-60 {
    background: url('../images/avatar-group-60.png') no-repeat 0 0;
}

.fep-avatar-p .fep-avatar-more-60 {
    left: 60px;
    position: absolute;
    top: 0;
}

.fep-attachments {
    border-top:1px solid #e7e7e7;
    padding: 5px;
    margin-top: 15px;
}

.fep-attachments-heading {
    font-size: 18px;
    font-weight: bold;
}

.fep-attachment-icon {
    background: transparent url('../images/attachment-icons.png') no-repeat;
    margin-right: 4px;
    height: 16px;
    width: 16px;
    display: inline-block;
}

.fep-attachment-icon.fep-attachment-icon-default {
    background-position: 0 0;
}

.fep-attachment-icon.fep-attachment-icon-generic {
    background-position: 0 -16px;
}
/* need in php */
.fep-attachment-icon.fep-attachment-icon-code {
    background-position: 0 -32px;
}

.fep-attachment-icon.fep-attachment-icon-xml {
    background-position: 0 -48px;
}

.fep-attachment-icon.fep-attachment-icon-excel {
    background-position: 0 -64px;
}

.fep-attachment-icon.fep-attachment-icon-word {
    background-position: 0 -80px;
}

.fep-attachment-icon.fep-attachment-icon-image {
    background-position: 0 -96px;
}

.fep-attachment-icon.fep-attachment-icon-psd {
    background-position: 0 -112px;
}

.fep-attachment-icon.fep-attachment-icon-ai {
    background-position: 0 -128px;
}

.fep-attachment-icon.fep-attachment-icon-archive {
    background-position: 0 -144px;
}

.fep-attachment-icon.fep-attachment-icon-text {
    background-position: 0 -160px;
}

.fep-attachment-icon.fep-attachment-icon-powerpoint {
    background-position: 0 -176px;
}

.fep-attachment-icon.fep-attachment-icon-pdf {
    background-position: 0 -192px;
}

.fep-attachment-icon.fep-attachment-icon-html {
    background-position: 0 -208px;
}

.fep-attachment-icon.fep-attachment-icon-video {
    background-position: 0 -224px;
}

.fep-attachment-icon.fep-attachment-icon-documents {
    background-position: 0 -240px;
}

.fep-attachment-icon.fep-attachment-icon-audio {
    background-position: 0 -256px;
}

.fep-attachment-icon.fep-attachment-icon-icon {
    background-position: 0 -272px;
}

#fep-menu-toggle-button {
    display: none;
}
#fep-menu-toggle-button:after {
    content: '+';
    float: right;
    margin-left: 5px;
    font-size: 24px;
    font-weight: bold;
}
#fep-menu-toggle-button.fep-menu-toggle-expanded:after {
    content: '-';
}

.fep-loader {
    cursor: wait;
    background:#ffffff url('../images/loading.gif') no-repeat center center;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=75)";
    filter: alpha(opacity=75);
    opacity: 0.75;
    position: absolute;
    z-index: 9999;
    display: none;
}

#fep-content-single {
    display: flex;
}
#fep-content-single #fep-content-single-sidebar {
    padding: 5px;
    flex: 20%;
    min-width: 150px;
}
#fep-content-single #fep-content-single-main {
    width: 100%;
}
.fep-message-head {
    cursor: pointer;
}
.fep-filter-heads-div {
    margin-top: 5px;
    margin-bottom: 10px;
}

#fep-content-single-heads .fep-message-head-active {
    border-radius: 0px 30px 30px 0px;
}

#fep-content-single-heads .fep-error {
    background-color: #ffebe8;
    border-color: #c00;
}


@media screen and (max-width: 480px) {
    .fep-table .fep-column-avatar {
        display: none;
    }

    .fep-action-table,
    .fep-action-table > div,
    .fep-action-table > div > div {
        display: block;
    }
    
    .fep-action-table > div > div {
        width: 100%;
    }
    
    #fep-menu .fep-button,
    .fep-button,
    .fep-button-active {
        width: 100%;
    }
    .fep-menu-toggle {
        display: none;
    }
    #fep-menu-toggle-button {
        display: block;
    }
    #fep-content-single #fep-content-single-sidebar {
        display: none;
    }
}
@media screen and (max-width: 768px) {
    .fep-table .fep-message-excerpt {
        display: none;
    }
}

【问题讨论】:

  • 为了澄清这个问题被关闭的原因,这是因为它包含way太多代码来解决一个简单的问题。您需要创建一个minimal reproducible example(此处强调minimal)来重现您的问题。如果您仍然遇到此问题并需要答案,请使用edit 链接更新您的问题,遵循上述链接指南。

标签: php css wordpress


【解决方案1】:

您可以使用 JS 代码来执行此操作。 使用此代码删除带有 JS 的 HTML 标记类:

<script>
      var element = document.getElementById(".fep-avatar-more-60");
      element.classList.remove("fep-avatar-more-60");
</script>

【讨论】:

    【解决方案2】:

    最好的方法是使用Jquery来删除类。

    我们应该记住几件事。

    1. .fep-avatar-more-60 类可以有多个实例。
    2. 我们获取该类的所有实例并使用.each() 循环它。
    3. 完成后,使用.removeClass() 删除上述类。

    $(function() {
      var fepAvatars = $('.fep-avatar-more-60');
      fepAvatars.each(function( key, fepAvatar ) {
        fepAvatars.removeClass("fep-avatar-more-60");
      });
    });
    .fep-avatar-more-60 {
      color: red;
    }
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <span class="fep-avatar-more-60">
      Something
    </span>
    adadasd
    <span class="fep-avatar-more-60">
      Other thing
    </span>

    说明

    这个特殊的例子展示了这个类的两个实例。两者都使用类标记为红色。但是通过查询,类被删除并且未设置红色。您可以通过注释掉 Jquery 来测试,看看文本确实是红色的。

    所以总结一下。在要删除该类的页面上添加此 Jquery

    $(function() {
      var fepAvatars = $('.fep-avatar-more-60');
      fepAvatars.each(function( key, fepAvatar ) {
        fepAvatars.removeClass("fep-avatar-more-60");
      });
    });
    

    【讨论】:

    • 你好,为什么要加载一个完整的库,而 js 可以轻松处理它:for (let e of document.querySelectorAll(".fep-avatar-more-60")) { e.classList.remove("fep-avatar-more-60"); } 这是可以在一行中使用和设置的语法之一;)
    • @G-Cyrillus,好吧,作者正在使用 wordpress,并且由于 Jquery 是 wordpress 的依赖项,他/她肯定会以任何方式加载 JQuery,因此使用 Jquery 是有意义的,因为页面不会加载任何额外的依赖项。这是插件作者使用的 SVN:plugins.svn.wordpress.org/front-end-pm/branches/5.1/assets/js。您可以看到正在使用 Jquery。但我确实同意香草 JS 也应该是正确的。
    猜你喜欢
    • 2016-05-21
    • 2021-11-19
    • 2013-04-26
    • 1970-01-01
    • 2021-10-04
    • 1970-01-01
    • 2021-07-16
    • 2014-10-24
    • 1970-01-01
    相关资源
    最近更新 更多