Example #1
0
<section id="post-<?php 
the_ID();
?>
" <?php 
post_class(array('top-block', 'clearfix', 'home-post'));
?>
>
	
	<?php 
pb_get_links(false);
?>
	<?php 
$metadata = pb_get_book_information();
?>
	<div class="log-wrap">	<!-- Login/Logout -->
	   <?php 
if (!is_single()) {
    ?>
	    	<?php 
    if (!is_user_logged_in()) {
        ?>
				<a href="<?php 
        echo wp_login_url(get_permalink());
        ?>
" class=""><?php 
        _e('login', 'pressbooks');
        ?>
</a>
	   	 	<?php 
    } else {
        ?>
<section id="post-<?php the_ID(); ?>" <?php post_class( array( 'top-block', 'clearfix', 'home-post' ) ); ?>>
	
	<?php pb_get_links(false); ?>
	<?php $metadata = pb_get_book_information();?>
	<div class="log-wrap">	<!-- Login/Logout -->
	   <?php if (! is_single()): ?>
	    	<?php if (!is_user_logged_in()): ?>
				<a href="<?php echo wp_login_url(); ?>" class=""><?php _e('login', 'pressbooks'); ?></a>
	   	 	<?php else: ?>
				<a href="<?php echo  wp_logout_url(); ?>" class=""><?php _e('logout', 'pressbooks'); ?></a>
				<?php if (is_super_admin() || is_user_member_of_blog()): ?>
				<a href="<?php echo get_option('home'); ?>/wp-admin"><?php _e('Admin', 'pressbooks'); ?></a>
				<?php endif; ?>
	    	<?php endif; ?>
	    <?php endif; ?>
	</div>   
						
			<div class="book-info">
				<!-- Book Title -->
				<h1 class="entry-title"><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
				
				<?php if ( ! empty( $metadata['pb_author'] ) ): ?>
				<p class="book-author vcard author"><span class="fn"><?php echo $metadata['pb_author']; ?></span></p>
			     	<span class="stroke"></span>
				<?php endif; ?>
				
				<?php if ( ! empty( $metadata['pb_contributing_authors'] ) ): ?>
					<p class="book-author"><?= $metadata['pb_contributing_authors']; ?> </p>
				<?php endif; ?>
					
				<?php if ( ! empty( $metadata['pb_about_140'] ) ) : ?>
            if ('chapter' == get_post_type($post->ID)) {
                $part_title = get_post_field('post_title', $post->post_parent);
                if (!is_wp_error($part_title)) {
                    echo "<small class='alignright'>" . $part_title . "</small>";
                }
            }
            ?>
			<h2 class="entry-title"><?php 
            if ($chapter_number = pb_get_chapter_number($post->post_name)) {
                echo "<span>{$chapter_number}</span>  ";
            }
            the_title();
            ?>
</h2>
			<?php 
            pb_get_links();
            ?>
			<div id="post-<?php 
            the_ID();
            ?>
" <?php 
            post_class(pb_get_section_type($post));
            ?>
>

				<div class="entry-content">
					  <?php 
            if ($subtitle = get_post_meta($post->ID, 'pb_subtitle', true)) {
                ?>
						<h2 class="chapter_subtitle"><?php 
                echo $subtitle;
Example #4
0
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php get_header(); ?>
<?php if (get_option('blog_public') == '1' || (get_option('blog_public') == '0' && current_user_can_for_blog($blog_id, 'read'))): ?>

				<?php edit_post_link( __( 'Edit', 'pressbooks' ), '<span class="edit-link">', '</span>' ); ?>
			<h2 class="entry-title"><?php
				if ( $chapter_number = pb_get_chapter_number( $post->post_name ) ) echo "<span>$chapter_number</span>  ";
				the_title();
				?></h2>
					<?php pb_get_links(); ?>
				<div id="post-<?php the_ID(); ?>" <?php post_class( pb_get_section_type( $post ) ); ?>>
					
					<div class="entry-content">
					  <?php if ($subtitle = get_post_meta($post->ID, 'pb_subtitle', true)): ?>
					    <h2 class="chapter_subtitle"><?php echo $subtitle; ?></h2> 
				    <?php endif;?>
				    <?php if ($chap_author = get_post_meta($post->ID, 'pb_section_author', true)): ?>
				       <h2 class="chapter_author"><?php echo $chap_author; ?></h2>
			      <?php endif; ?>
									
					<?php if ( get_post_type( $post->ID ) !== 'part' ) {
						$content = apply_filters ( 'the_content', get_the_content() );
						$s = 1;
						while ( strpos( $content, '<h1>' ) !== false ) {
						    $content = preg_replace('/<h1>/', '<h1 id="section-' . $s++ . '">', $content, 1);
						}
						echo $content;
					} else {
						echo apply_filters( 'the_content', get_post_meta( $post->ID, 'pb_part_content', true ) );
			} ?>