Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
263 views
in Technique[技术] by (71.8m points)

How to properly edit styles in a WordPress plugin

I need to edit the styles in the plugin. If they were not written inline. It would be easier. I would limit myself to using a simple CSS file in the child theme. But the styles are written inline:

public static function generate_print_button_for_user($order, $order_id, $template_type, $action, $action_data)
{
    $show_button=true;
    
    /* toggle the visibility for admin/customer */
    $show_button=apply_filters('wt_pklist_toggle_email_print_buttons', $show_button, $order, $template_type, $action_data['email_button'], $action_data['sent_to_admin']);

    if($show_button)
    {
        $style='';
        if($action_data['email_button'])
        {
            $style='background:#514763; border-color:#514763; text-align: center; display: block;  color:#fff; text-decoration:none; padding:10px; border-radius:0; text-shadow:0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;';
            $style=apply_filters('wt_pklist_alter_email_button_style', $style, $order, $template_type, $action_data['sent_to_admin']);
        }
        $button = '<a class="button button-primary" style="'.$style.'" target="_blank" href="'.$action_data['url'].'">???? ?????? ?????</a><br><br>';
        echo $button;
    }
}

For now, I just made changes to the plugin file. But this is not correct, after the update, my custom styles will disappear. Tell me how to do it right in this case?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Why you don't add custom code in Wordpress panel?
You can add custom CSS style code in Appearance -> Customize -> Additional CSS
Its overwrite on plugin CSS code.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...