• Resolved michaellindahl

    (@michaellindahl)


    My page looks like this in the HTML tab:

    [ai1ec view="monthly"]
    
    <code>
    <style type="text/css">
    body {
    background: none;
    text-shadow: none;
    top: -20px;
    }
    html {
    margin-top: 0px;
    }
    #header, #footer, #ribbon, p, .ai1ec-calendar-toolbar, .ai1ec-title-buttons, #wpadminbar, .post-edit-link {
    display: none;
    }
    </style>
    </code>

    However when I click Visual and then go back to HTML it goes to this:

    [ai1ec view="monthly"]
    
    <code>
    
    </code>

    Why is WordPress removing my style paragraph???!

Viewing 4 replies - 1 through 4 (of 4 total)
  • It’s standard “security” to not allow CSS and JavaScript in posts like that. So, they get stripped out.

    One thing that I would like to point out is that setting styles for the body, html, etc when you are actually inside those elements is a very bad idea. At best, you’ll get validation errors. At worst, those styles will be ignored. Anything like that should be added to the style.css stylesheet file of your theme.

    Thread Starter michaellindahl

    (@michaellindahl)

    I understand this. However if I save from the HTML tab it works fine. I am doing this to create a printable page for the calendar. Is there a better way to do this?
    https://bethanypc.com/calendar/campus/print/ comes from https://bethanypc.com/calendar/campus/

    Then use only the HTML tab. That’s all that you can do. The visual editor will always strip out these things (well, unless you want to do some wide-scale hacking that will probably break a lot of stuff).

    I’ve already said the better way to do it. Use your styles.css file to hold these definitions. That’s what its there for. If it needs to be different for individual pages, then you can add in the classes that are set on the body tag to make it more customised. If you are a bit more technically-mided, you can set up your functions.php file to include different CSS files based on whatever criteria you want to use.

    Thread Starter michaellindahl

    (@michaellindahl)

    Thanks for the input. I went the route of creating a new page template:

    <?php
    /**
     * Template Name: Blank
     *
     * The template for displaying a blank.
     */
    ?>
    <!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    <meta charset="<?php bloginfo('charset'); ?>" />
    <title><?php wp_title('|', true, 'right'); bloginfo('name'); ?></title>
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <?php if($ct_favicon): ?>
    <link rel="icon" type="image/png" href="<?php echo $ct_favicon; ?>" />
    <?php endif; ?>
    <?php if($ct_ios_icon): ?>
    <link rel="apple-touch-icon" href="<?php echo $ct_ios_icon; ?>" />
    <?php endif; ?>
    <?php wp_enqueue_script('jquery') ?>
    <style type="text/css">
    .ai1ec-date, .btn {
    background: white;
    text-shadow: none !important;
    }
    .ai1ec-calendar-toolbar, .ai1ec-title-buttons, #wpadminbar, .ai1ec-subscribe, .ai1ec-subscribe-google, img#wpstats {
    display: none;
    }
    a.btn.ai1ec-subscribe, a.btn.ai1ec-subscribe-google {
    display: none;
    }
    </style>
    </head>
    <body <?php body_class(); ?>>
    	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    			<?php the_content(); ?>
    	<?php endwhile; ?>
    <?php if($ct_analytics_code): echo $ct_analytics_code; endif; ?>
    <?php
    	/* Always have wp_footer() just before the closing </body>
    	 * tag of your theme, or you will break many plugins, which
    	 * generally use this hook to reference JavaScript files.
    	 */
    	wp_footer();
    ?>
    </body>
    </html>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WordPress deletes my style paragrah’ is closed to new replies.