Skip to content

Commit

Permalink
Bug #18, work-in-progress filter plugin; [iet:7791015][iet:7800747]
Browse files Browse the repository at this point in the history
* Plus, Guide-case study flag, in `Simple_Menu` plugin
  • Loading branch information
nfreear committed Jan 19, 2017
1 parent 7b82111 commit a93bfd1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions simple_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,16 @@ protected function display_content( $sub_menu, $menu_id, $classes, $show_comment
<?php echo apply_filters('the_content', get_post_field( 'post_content', $it->object_id )) ?>
<?php self::display_comments( $it->object_id, $show_comments ) ?>
</div>

<?php if ( defined( 'TTTT_GUIDE_CASE_STUDY' ) ): ?>
<div class="col-md-3 case-study">
<!-- Tricky topics guide -->
<p><img src="/wp-content/themes/tttt-guide/images/default-case-study.png" alt="" /></p>
<h4 class="cs-title"> Case study </h4>
<?php echo apply_filters( 'lorem_small', null ) ?>
<a href="#view-more" role="button" data-toggle="tooltip" title="View the case study.">View more</a>
</div>
<?php endif; ?>

<?php if ( $with_top_link ): ?>
<div class="col-md-12"><a href="#site-main" class="col-md-9 tttt-to-top">Return to top of page</a></div>
Expand Down
38 changes: 38 additions & 0 deletions work-in-progress-filter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php namespace IET_OU\WP_Generic_Plugins;

/**
* Plugin Name: Work-in-progress
* Plugin URI:
* Description: ...
* Author: Nick Freear
* Author URI: https://github.com/nfreear
* Version: 1.0-alpha
*
* @copyright © 2017 The Open University (UK).
* @author Nick Freear, 19 January 2017.
* @link https://en-gb.wordpress.org/plugins/lorem-shortcode/
*/

class Work_In_Progress_Filter_Plugin {

public function __construct() {
add_filter( 'the_content', [ &$this, 'filter_the_content' ]);
}


public function filter_the_content( $content ) {

if ( ! $content ) {

$page_slug = defined( 'WORK_IN_PROGRESS_SLUG' ) ? WORK_IN_PROGRESS_SLUG : 'work-in-progress';

$wp_post = get_page_by_path( $page_slug );

return '<div class="'. $page_slug .'">' . $wp_post->post_content . '</div>';
}

return $content;
}

}
$plugin = new Work_In_Progress_Filter_Plugin();

0 comments on commit a93bfd1

Please sign in to comment.