Updates for part 2

This commit is contained in:
Tania 2016-01-14 02:48:43 -06:00
parent fb8eaa1fda
commit 8c83a49a7c
15 changed files with 243 additions and 47 deletions

27
comments.php Normal file
View file

@ -0,0 +1,27 @@
<?php if ( post_password_required() ) {
return;
} ?>
<div id="comments" class="comments-area">
<?php if ( have_comments() ) : ?>
<h3 class="comments-title">
<?php
printf( _nx( 'One comment on &ldquo;%2$s&rdquo;', '%1$s comments on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title'),
number_format_i18n( get_comments_number() ), get_the_title() );
?>
</h3>
<ul class="comment-list">
<?php
wp_list_comments( array(
'short_ping' => true,
'avatar_size' => 50,
) );
?>
</ul>
<?php endif; ?>
<?php if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
<p class="no-comments">
<?php _e( 'Comments are closed.' ); ?>
</p>
<?php endif; ?>
<?php comment_form(); ?>
</div>

9
content-single.php Normal file
View file

@ -0,0 +1,9 @@
<div class="blog-post">
<h2 class="blog-post-title"><?php the_title(); ?></h2>
<p class="blog-post-meta"><?php the_date(); ?> by <a href="#"><?php the_author(); ?></a></p>
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
} ?>
<?php the_content(); ?>
</div><!-- /.blog-post -->

View file

@ -1,7 +1,28 @@
<div class="blog-post">
<h2 class="blog-post-title"><?php the_title(); ?></h2>
<p class="blog-post-meta"><?php the_date(); ?> by <a href="#"><?php the_author(); ?></a></p>
<h2 class="blog-post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<p class="blog-post-meta">
<?php the_date(); ?> by
<a href="#">
<?php the_author(); ?>
</a> &bull;
<a href="<?php comments_link(); ?>">
<?php
printf( _nx( 'One Comment', '%1$s Comments', get_comments_number(), 'comments title', 'textdomain' ), number_format_i18n( get_comments_number() ) ); ?>
</a>
</p>
<?php the_content(); ?>
<?php if ( has_post_thumbnail() ) {?>
<div class="row">
<div class="col-md-4">
<?php the_post_thumbnail('thumbnail'); ?>
</div>
<div class="col-md-6">
<?php the_excerpt(); ?>
</div>
</div>
<?php } else { ?>
<?php the_excerpt(); ?>
<?php } ?>
</div><!-- /.blog-post -->
</div>
<!-- /.blog-post -->

6
css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -7,8 +7,6 @@
</p>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<?php wp_footer(); ?>
</body>
</html>

View file

@ -0,0 +1,97 @@
<?php
// Add scripts and stylesheets
function startwordpress_scripts() {
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.3.6' );
wp_enqueue_style( 'blog', get_template_directory_uri() . '/css/blog.css' );
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '3.3.6', true );
}
add_action( 'wp_enqueue_scripts', 'startwordpress_scripts' );
// Add Google Fonts
function startwordpress_google_fonts() {
wp_register_style('OpenSans', '//fonts.googleapis.com/css?family=Open+Sans:400,600,700,800');
wp_enqueue_style( 'OpenSans');
}
add_action('wp_print_styles', 'startwordpress_google_fonts');
// WordPress Titles
function startwordpress_wp_title( $title, $sep ) {
global $paged, $page;
if ( is_feed() ) {
return $title;
}
// Add the site name.
$title .= get_bloginfo( 'name' );
// Add the site description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) {
$title = "$title $sep $site_description";
}
return $title;
}
add_filter( 'wp_title', 'startwordpress_wp_title', 10, 2 );
// Custom settings
function custom_settings_add_menu() {
add_menu_page( 'Custom Settings', 'Custom Settings', 'manage_options', 'custom-settings', 'custom_settings_page', null, 99);
}
add_action( 'admin_menu', 'custom_settings_add_menu' );
// Create Custom Global Settings
function custom_settings_page() { ?>
<div class="wrap">
<h1>Custom Settings</h1>
<form method="post" action="options.php">
<?php
settings_fields('section');
do_settings_sections('theme-options');
submit_button();
?>
</form>
</div>
<?php }
// Twitter
function setting_twitter() { ?>
<input type="text" name="twitter" id="twitter" value="<?php echo get_option('twitter'); ?>" />
<?php }
function setting_github() { ?>
<input type="text" name="github" id="github" value="<?php echo get_option('github'); ?>" />
<?php }
function custom_settings_page_setup() {
add_settings_section('section', 'All Settings', null, 'theme-options');
add_settings_field('twitter', 'Twitter URL', 'setting_twitter', 'theme-options', 'section');
add_settings_field('github', 'GitHub URL', 'setting_github', 'theme-options', 'section');
register_setting('section', 'twitter');
register_setting('section', 'github');
}
add_action( 'admin_init', 'custom_settings_page_setup' );
// Support Featured Images
add_theme_support( 'post-thumbnails' );
// Custom Post Type
function create_my_custom_post() {
register_post_type('my-custom-post',
array(
'labels' => array(
'name' => __('My Custom Post'),
'singular_name' => __('My Custom Post'),
),
'public' => true,
'has_archive' => true,
'supports' => array(
'title',
'editor',
'thumbnail',
'custom-fields'
)
));
}
add_action('init', 'create_my_custom_post');

View file

@ -8,14 +8,10 @@
<meta name="description" content="">
<meta name="author" content="">
<title><?php echo get_bloginfo( 'name' ); ?> </title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<link href="<?php bloginfo('template_directory');?>/blog.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<title>
<?php wp_title( '|', true, 'right' ); ?>
</title>
<?php wp_head();?>
</head>
@ -33,5 +29,7 @@
<div class="blog-header">
<h1 class="blog-title"><a href="<?php bloginfo('wpurl');?>"><?php echo get_bloginfo( 'name' ); ?></a></h1>
<p class="lead blog-description"><?php echo get_bloginfo( 'description' ); ?></p>
<p class="lead blog-description">
<?php echo get_bloginfo( 'description' ); ?>
</p>
</div>

View file

@ -1,23 +1,18 @@
<?php get_header(); ?>
<div class="row">
<div class="col-sm-8 blog-main">
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
endwhile; endif;
?>
</div>
<!-- /.blog-main -->
endwhile; ?>
<nav>
<ul class="pager">
<li><?php next_posts_link( 'Previous' ); ?></li>
<li><?php previous_posts_link( 'Next' ); ?></li>
</ul>
</nav>
<?php endif; ?>
</div> <!-- /.blog-main -->
<?php get_sidebar(); ?>
</div>
<!-- /.row -->
</div> <!-- /.row -->
<?php get_footer(); ?>

7
js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

24
page-custom.php Normal file
View file

@ -0,0 +1,24 @@
<?php get_header(); ?>
<div class="row">
<div class="col-sm-12">
<?php
$args = array(
'post_type' => 'my-custom-post',
'orderby' => 'menu_order',
'order' => 'ASC'
);
$custom_query = new WP_Query( $args );
while ($custom_query->have_posts()) : $custom_query->the_post(); ?>
<div class="blog-post">
<h2 class="blog-post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
</div>
<?php endwhile; ?>
</div> <!-- /.col -->
</div> <!-- /.row -->
<?php get_footer(); ?>

View file

@ -12,10 +12,8 @@
endwhile; endif;
?>
</div>
<!-- /.col -->
</div> <!-- /.col -->
</div>
<!-- /.row -->
</div> <!-- /.row -->
<?php get_footer(); ?>

View file

@ -12,8 +12,8 @@
<div class="sidebar-module">
<h4>Elsewhere</h4>
<ol class="list-unstyled">
<li><a href="#">GitHub</a></li>
<li><a href="#">Twitter</a></li>
<li><a href="<?php echo get_option('github'); ?>">GitHub</a></li>
<li><a href="<?php echo get_option('twitter'); ?>">Twitter</a></li>
<li><a href="#">Facebook</a></li>
</ol>
</div>

16
single.php Normal file
View file

@ -0,0 +1,16 @@
<?php get_header(); ?>
<div class="row">
<div class="col-sm-12">
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
get_template_part( 'content-single', get_post_format() );
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile; endif;
?>
</div> <!-- /.col -->
</div> <!-- /.row -->
<?php get_footer(); ?>

View file

@ -1,7 +1,7 @@
/*
Theme Name: Start Wordpress
Theme Name: Start WordPress
Author: Tania Rascia
Description: Bootstrap Blog template converted to Wordpress
Version: 0.0.1
Version: 0.0.2
Tags: bootstrap
*/