import re with open("tmp_pricing.html", "r") as f: text = f.read() # Insert the CSS css_to_insert = """ /* Custom Header */ body.page-id-50 .wp-site-blocks > header.wp-block-template-part { display: none !important; } .kmc-new-header-wrap { position: sticky; top: var(--wp-admin--admin-bar--height, 0px); z-index: 9999; background-color: #1C3434; border-bottom: 1px solid rgba(144, 241, 174, 0.45); } .kmc-new-header-inner { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; width: min(1440px, calc(100% - 72px)); margin: 0 auto; } .kmc-new-logo { color: #FFFFFF; font-family: 'Inter', sans-serif; font-size: clamp(16px, 1.8vw, 20px); font-weight: 700; text-decoration: none; line-height: 1.08; letter-spacing: -0.01em; } .kmc-new-nav-right { display: flex; align-items: center; gap: clamp(16px, 2.2vw, 36px); } .kmc-new-nav-links { display: flex; align-items: center; gap: clamp(16px, 2vw, 30px); } .kmc-new-nav-links a { color: rgba(255,255,255,0.95); font-family: 'Inter', sans-serif; font-size: 18px; font-weight: 600; text-decoration: none; line-height: 1.2; } .kmc-new-header-cta { background-color: #FFFFFF; color: #1C3434; font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 700; padding: 12px 24px; border-radius: 999px; text-decoration: none; display: inline-flex; align-items: center; line-height: 1; } @media (max-width: 980px) { .kmc-new-header-inner { width: calc(100% - 48px); } .kmc-new-header-inner { flex-wrap: wrap; padding: 18px 0; } .kmc-new-nav-right { width: 100%; justify-content: space-between; margin-top: 16px; } } @media (max-width: 680px) { .kmc-new-header-inner { width: calc(100% - 28px); } .kmc-new-logo { font-size: 18px; } .kmc-new-nav-right { flex-direction: column; align-items: flex-start; gap: 14px; } .kmc-new-nav-links a { font-size: 16px; } .kmc-new-header-cta { font-size: 14px; } } """ html_to_insert = """
""" # Find the end of the second " in text: parts = text.rsplit("", 1) text = parts[0] + css_to_insert + "\n\n" + html_to_insert + parts[1] with open("tmp_pricing.html", "w") as f: f.write(text) print("SUCCESS")