Skip to content

Commit

Permalink
first release
Browse files Browse the repository at this point in the history
  • Loading branch information
intoxstudio committed Mar 5, 2017
1 parent edaa99c commit 4024e24
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.php
@@ -0,0 +1,2 @@
<?php
/**/
2 changes: 2 additions & 0 deletions templates/index.php
@@ -0,0 +1,2 @@
<?php
/**/
34 changes: 34 additions & 0 deletions templates/page.php
@@ -0,0 +1,34 @@
<?php
/**
* @package Page Sidebar for TwentySeventeen
* @author Joachim Jensen <jv@intox.dk>
* @license GPLv3
* @copyright 2017 by Joachim Jensen
*/

get_header(); ?>

<div class="wrap">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">

<?php
while ( have_posts() ) : the_post();

get_template_part( 'template-parts/page/content', 'page' );

if ( comments_open() || get_comments_number() ) :
comments_template();
endif;

endwhile;
?>

</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div><!-- .wrap -->

<?php get_footer();

//
61 changes: 61 additions & 0 deletions twentyseventeen-page-sidebar.php
@@ -0,0 +1,61 @@
<?php
/**
* @package Page Sidebar for TwentySeventeen
* @author Joachim Jensen <jv@intox.dk>
* @license GPLv3
* @copyright 2017 by Joachim Jensen
*/
/*
* Plugin Name: Page Sidebar for TwentySeventeen
* Plugin URI: https://mythemeshop.com/plugins/wp-quiz/
* Description: Adds the main sidebar to pages. Install Content Aware Sidebars for customization.
* Version: 1.0
* Author: Joachim Jensen
* Author URI: https://dev.institute
*
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Check if sidebar should be added
*
* @since 1.0
* @return boolean
*/
function psts_in_context() {
return is_page() && !is_front_page();
}

/**
* Add relevant classes to body
*
* @since 1.0
* @param array $classes
* @return array
*/
function psts_body_classes( $classes ){
if ( psts_in_context() && is_active_sidebar( 'sidebar-1' ) ) {
$classes[] = 'has-sidebar';
}
return $classes;
}

/**
* Include page template
*
* @since 1.0
* @param string $original_template
* @return string
*/
function psts_template( $original_template ) {
if ( psts_in_context() ) {
$original_template = plugin_dir_path( __FILE__ ) . 'templates/page.php';
}
return $original_template;
}

add_filter( 'body_class', 'psts_body_classes' );
add_filter( 'template_include', 'psts_template' );

0 comments on commit 4024e24

Please sign in to comment.