Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've got the following problem. When I switch from 'text' to 'visual' mode - TinyMCE is automatically messing around in the code doing unwanted things which breaks my styling - not so good ;/.

Is there a way to protect parts from being modified by the text editor automatically? Some kind of [dont_touch_my_code] shortcode or something like that?

This is my code before:

[eo_events numberposts="6" showpastevents="false" event_category=""]
<div class="cal_bubble" style="background-color:%cat_color%;">
  <div class="main">
    <span class="month">%start{M}%</span><span class="year">%start{Y}%</span>
   <p>
     <span class="day">%start{d}%</span>
   </p>
  </div>
    <div class="side">
      <div class="inner"><div class="top"></div> 
     <div class="bottom"></div> 
    </div>
  </div>   
</div>
  <div class="cal_bubbletext">
 <div>
  <h4><a href="%event_url%"> %event_title% </a></h4>%event_excerpt%
  %start{H:i}% - %end{H:i}% Uhr  %event_venue% 
 </div>  
</div>
[/eo_events]

And this is the code after switching to visual mode and back.

[eo_events numberposts="6" showpastevents="false" event_category=""]
<div class="cal_bubble" style="background-color: %cat_color%;">
<div class="main"><span class="month">%start{M}%</span><span class="year">%start{Y}%</span><span class="day">%start{d}%</span>

</div>
<div class="side"></div>
</div>
<div class="cal_bubbletext">
<div>
<h4><a href="%event_url%"> %event_title% </a></h4>
%event_excerpt%
%start{H:i}% - %end{H:i}% Uhr %event_venue%

</div>
</div>
[/eo_events]
share|improve this question
    
I realized that there's a plugin called raw-html which should help me in this situation. But this is not working with shortcodes and is broken in wp 3.7 –  Hexodus Nov 1 '13 at 10:55
    
isn't the point of shortcodes to avoid having to litter your posts with markup? –  Milo Nov 1 '13 at 14:58
    
Shortcodes are nice but (1) it's not easy to read especially if you want to output long JavaScript sequence/and/or HTML (2) it not dynamic: you have to hard-code everything for each code you want to add. Having a "tag" or "shortcode" in the article that could say "hey dont touch at all what's in it" should be very useful –  Olivier Pons Nov 25 '13 at 9:54
    
@Hexodus, I notice you're using Event Organiser - for something as complicated as this, might I suggest you copy the event list shortcode template and edit that, rather than wrapping the shortcode around a template? –  Stephen Harris May 27 at 23:16
    
@StephenHarris Thanks Stephen, this is exactly what I did. You pointed me already in your forum in this direction a while ago. Best. Adrian –  Hexodus May 30 at 11:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.