[Plugin: WP-SlidesJS] Patch: Optionally add paragraphs to content and parse shortcodes ( title )
-
Following is a patch for wp-slidesjs which adds two new options:
1. Parse shotcodes in content
2. Automatically add paragraphs/breaks to content
Also, I’ve changed the title <div> to <h1> for better semantics.--- wp-slidesjs.php Mon Aug 20 16:10:35 2012 +++ wp-slidesjs.php Mon Aug 20 16:10:35 2012 @@ -199,6 +199,24 @@ <span class="default"><?php _e('Default ', WP_SLIDESJS_PARAM); ?>: <?php $this->content_source( $this->defaults['contentSource'] , true ) ; ?></span> </p> </dd> + <dt> + <label for="contentShortcodes"><?php _e('Parse shortcodes', WP_SLIDESJS_PARAM); ?></label> + </dt> + <dd> + <input type="checkbox" name="contentShortcodes" id="contentShortcodes" value="1" <?php checked($this->options['contentShortcodes'],true); ?> /> + <span class="description"><?php _e('Parse shortcodes in content (just like default WordPress processing of posts).', WP_SLIDESJS_PARAM); ?></span> + <span class="default"><?php _e('Default ', WP_SLIDESJS_PARAM); ?>: <?php $this->print_bool( $this->defaults['contentShortcodes']); ?></span> + </p> + </dd> + <dt> + <label for="contentAutoParagraphs"><?php _e('Auto paragraphs', WP_SLIDESJS_PARAM); ?></label> + </dt> + <dd> + <input type="checkbox" name="contentAutoParagraphs" id="contentAutoParagraphs" value="1" <?php checked($this->options['contentAutoParagraphs'],true); ?> /> + <span class="description"><?php _e('Automatically add <p> and <br> tags to content (just like default WordPress processing of posts).', WP_SLIDESJS_PARAM); ?></span> + <span class="default"><?php _e('Default ', WP_SLIDESJS_PARAM); ?>: <?php $this->print_bool( $this->defaults['contentAutoParagraphs']); ?></span> + </p> + </dd> </dl> </fieldset> @@ -332,6 +350,8 @@ 'bigTarget'=>false, 'defaultCSS'=>true, 'contentSource'=>'post_content', + 'contentShortcodes'=>false, + 'contentAutoParagraphs'=>false, ); $this->defaults = $defaults; @@ -468,11 +488,15 @@ $domsxe = simplexml_load_string( get_the_post_thumbnail( $post->ID ) ); $thumbnailsrc = $domsxe->attributes()->src; } + + $content = $post->$contentsource; + if ($this->options['contentShortcodes']) $content = do_shortcode($content); + if ($this->options['contentAutoParagraphs']) $content = wpautop($content); $output .= ' <article class="wp-slidesjs-slide wp-slidesjs-roundtop"> - <div class="wp-slidesjs-title">'.$post->post_title.'</div> - <div class="wp-slidesjs-content">'.$post->$contentsource.'</div> + <h1 class="wp-slidesjs-title">'.$post->post_title.'</h1> + <div class="wp-slidesjs-content">'.$content.'</div> </article>'; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: WP-SlidesJS] Patch: Optionally add paragraphs to content and parse shortcodes ( title )’ is closed to new replies.