Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m trying a similar thing myself.
    You can put tags around the content you want editable in a page i.e.
    <div class="raptor-editable-area">

    then if you edit the encloseEditablePosts function in Raptor.php in the plugin folder you can replace those tags with ones for enabling raptor on that area.

    public function encloseEditablePosts($content) {
            global $post;
    
            if(current_user_can('edit_post', $post->ID)) {
    
                $replace = "<div class='raptor-editable-post' data-post_id='{$post->ID}'>";
                $content =  str_replace('<div class="raptor-editable-area">', $replace, $content);
            }
    
            return $content;
        }

    Then if you change the raptor-in-place-init.js in the javascript folder so that it goes through a loop of those areas rather than applying it to the whole doc… (just needs the top few lines adjusting)

    raptor(function($) {
        var textareas = $('.raptor-editable-post');
        if (!textareas.length) return;
    
        textareas.each(function() {
        //if (!$('.raptor-editable-post').length) return;
        $('.raptor-editable-post').editor({

    don’t forget to close off the loop with a new
    });

    at the bottom.

    I’ve now got editable areas in a post!. A touch hacky but seems to work. Any obvious probs, post them here – I’m still in my infancy with wordpress so I don’t know if I’m doing something terribly dodgy, but I can’t see a prob with it myself.

    Hey yakyak, which javascript file are you editing in the last section about raptor-in-place-init.js ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Limiting Editable areas’ is closed to new replies.