Skip to content

Commit

Permalink
Merge pull request #288 from MITLibraries/544-forms-disclosure
Browse files Browse the repository at this point in the history
Removes links to, and loops of, content indices
  • Loading branch information
matt-bernhardt authored Sep 4, 2019
2 parents c055c8f + 8955bcd commit 74110c2
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 197 deletions.
28 changes: 1 addition & 27 deletions 404.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,7 @@
<h1 class="entry-title">This file was not found.</h1>
</header>

<div class="entry-content">
<h2>Search the Libraries' web site:</h2>

<form action="https://www.google.com/cse" id="cse-search-box">
<div>
<input type="hidden" name="cx" value="012139403769412284441:qmnizspyywg">
<input type="hidden" name="ie" value="UTF-8">
<input type="text" name="q" size="80" style="width: 300px;">
<input type="submit" name="sa" value="Search">
</div>
</form>

<h2>Browse our <a href="/about/site-search">A-Z index of pages</a> on this site.</h2>

<p>You can also check out these commonly-used resources:</p>

<ul>
<li><a href="//libraries.mit.edu/quicksearch">Quick search: Books, articles, &amp; more at MIT</a></li>
<li><a href="//libguides.mit.edu/directory">Staff directory</a></li>
<li><a href="/research-guides">Research guides - databases by subject</a></li>
<li><a href="/about/shortcuts/">Shortcuts to frequently used pages</a></li>
<li><a href="//web.mit.edu/search.html">MIT web site search</a></li>
</ul>

<p><a href="/ask">Need more help? Ask us!</a></p>

</div><!-- .entry-content -->
<?php get_template_part( 'inc/site-search' ); ?>

</article><!-- #post-0 -->

Expand Down
101 changes: 39 additions & 62 deletions author.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,75 +10,52 @@
* @since 1.2.1
*/

get_header(); ?>

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

<?php if ( have_posts() ) : ?>

<?php

/*
* Queue the first post, that way we know
* what author we're dealing with (if that is the case).
*
* We reset this later so we can run the loop
* properly with a call to rewind_posts().
*/
the_post();
?>

<header class="archive-header">
<h1 class="archive-title">
Author Archives:
<span class="vcard">
<a class="url fn n" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" title="<?php echo esc_attr( get_the_author() ); ?>" rel="me">
get_header();

$sidebar_class = '';
if ( is_active_sidebar( 'sidebar-1' ) ) {
$sidebar_class = 'has-sidebar';
}
?>

<div id="stage" class="inner" role="main">
<div id="content" class="content <?php echo esc_attr( $sidebar_class ); ?>">

<div class="content-main main-content">

<?php if ( have_posts() ) : ?>
<?php

/*
* Queue the first post, that way we know
* what author we're dealing with (if that is the case).
*
* We reset this later so we can run the loop
* properly with a call to rewind_posts().
*/
the_post();
?>
<header class="archive-header">
<h1 class="archive-title">
Author Archives:
<span class="vcard">
<?php the_author(); ?>
</a>
</span>
</h1>
</header><!-- .archive-header -->
</span>
</h1>
</header><!-- .archive-header -->
<?php endif; ?>

<?php

/*
* Since we called the_post() above, we need to
* rewind the loop back to the beginning that way
* we can run the loop properly, in full.
*/
rewind_posts();
/* We removed the loop because we don't use this display template. */
?>

<?php twentytwelve_content_nav( 'nav-above' ); ?>

<?php
// If a user has filled out their description, show a bio on their entries.
if ( get_the_author_meta( 'description' ) ) : ?>
<div class="author-info">
<div class="author-avatar">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 60 ) ); ?>
</div><!-- .author-avatar -->
<div class="author-description">
<h2><?php printf( 'About %s', get_the_author() ); ?></h2>
<p><?php the_author_meta( 'description' ); ?></p>
</div><!-- .author-description -->
</div><!-- .author-info -->
<?php endif; ?>

<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>

<?php twentytwelve_content_nav( 'nav-below' ); ?>
</div>

<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<?php get_sidebar(); ?>
<?php endif; ?>

</div><!-- #content -->
</section><!-- #primary -->
</div>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>
49 changes: 20 additions & 29 deletions category.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,36 @@
* @since 1.2.1
*/

get_header(); ?>
get_header();

$sidebar_class = '';
if ( is_active_sidebar( 'sidebar-1' ) ) {
$sidebar_class = 'has-sidebar';
}
?>

<div id="stage" class="inner" role="main">
<div id="content" class="content has-sidebar">
<div id="content" class="content <?php echo esc_attr( $sidebar_class ); ?>">

<div class="content-main main-content">
<?php if ( have_posts() ) : ?>
<header class="archive-header">
<h1 class="archive-title">
<?php printf( 'Category Archives: %s', '<span>' . single_cat_title( '', false ) . '</span>' ); ?>
</h1>

<?php if ( category_description() ) : // Show an optional category description. ?>
<div class="archive-meta"><?php echo category_description(); ?></div>

<?php if ( have_posts() ) : ?>
<header class="archive-header">
<h1 class="archive-title">
<?php printf( 'Category Archives: %s', '<span>' . single_cat_title( '', false ) . '</span>' ); ?>
</h1>
</header><!-- .archive-header -->
<?php endif; ?>
</header><!-- .archive-header -->

<?php
/* Start the Loop */
while ( have_posts() ) : the_post();

/*
* Include the post format-specific template for the content. If you want to
* this in a child theme then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );

endwhile;

twentytwelve_content_nav( 'nav-below' );
/* We removed the loop because we don't use this display template. */
?>

<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>

</div>
<?php get_sidebar(); ?>

<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<?php get_sidebar(); ?>
<?php endif; ?>

</div><!-- #content -->
</div>
Expand Down
59 changes: 12 additions & 47 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,54 +412,19 @@ function twentytwelve_comment( $comment, $args, $depth ) {
endif;

if ( ! function_exists( 'twentytwelve_entry_meta' ) ) :
/**
* Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
*
* Create your own twentytwelve_entry_meta() to override in a child theme.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_entry_meta() {
// Translators: used between list items, there is a space after the comma.
$categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) );

// Translators: used between list items, there is a space after the comma.
$tag_list = get_the_tag_list( '', __( ', ', 'twentytwelve' ) );

$date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);

$author = sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
// Translators: View all posts by a given author.
esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ),
get_the_author()
);

// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
if ( $tag_list ) {
// Translators: Category, tag, date, and author values.
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
} elseif ( $categories_list ) {
// Translators: Category, date, and author values.
$utility_text = __( 'This entry was posted in %1$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
} else {
// Translators: Date and author values.
$utility_text = __( 'This entry was posted on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
/**
* Normally this function prints HTML with meta information for current
* post: categories, tags, permalink, author, and date. HOWEVER, our theme
* makes no use of this feature by design, and in its unaltered form there
* is a downside to having this code in place.
*
* We've thus removed the function almost entirely.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_entry_meta() {
return false;
}

printf(
$utility_text,
$categories_list,
$tag_list,
$date,
$author
);
}
endif;

if ( ! function_exists( 'is_child_page' ) ) {
Expand Down
37 changes: 37 additions & 0 deletions inc/site-search.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* This is the template for the site search form that points to the Google
* Custom Search Engine.
*
* @package MIT_Libraries_Parent
* @since 1.8.0
*/

?>
<div class="entry-content">

<form action="https://www.google.com/cse" id="cse-search-box">
<h2><label for="q">Search the Libraries' web site:</label></h2>
<div>
<input type="hidden" name="cx" value="012139403769412284441:qmnizspyywg">
<input type="hidden" name="ie" value="UTF-8">
<input type="text" id="q" name="q" size="80" style="width: 300px;">
<input type="submit" name="sa" value="Search">
</div>
</form>

<h2>Browse our <a href="/about/site-search">A-Z index of pages</a> on this site.</h2>

<p>You can also check out these commonly-used resources:</p>

<ul>
<li><a href="//libraries.mit.edu/quicksearch">Quick search: Books, articles, &amp; more at MIT</a></li>
<li><a href="//libguides.mit.edu/directory">Staff directory</a></li>
<li><a href="/research-guides">Research guides - databases by subject</a></li>
<li><a href="/about/shortcuts/">Shortcuts to frequently used pages</a></li>
<li><a href="//web.mit.edu/search.html">MIT web site search</a></li>
</ul>

<p><a href="/ask">Need more help? Ask us!</a></p>

</div><!-- .entry-content -->
47 changes: 15 additions & 32 deletions search.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,26 @@
* @since 1.2.1
*/

get_header(); ?>
get_header();

<section id="primary" class="site-content">
<div id="content" role="main">
$sidebar_class = '';
if ( is_active_sidebar( 'sidebar-1' ) ) {
$sidebar_class = 'has-sidebar';
}
?>

<?php if ( have_posts() ) : ?>
<div id="stage" class="inner" role="main">
<div id="content" class="content <?php echo esc_attr( $sidebar_class ); ?>">

<header class="page-header">
<h1 class="page-title"><?php printf( 'Search Results for: %s', '<span>' . get_search_query() . '</span>' ); ?></h1>
</header>

<?php twentytwelve_content_nav( 'nav-above' ); ?>

<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>

<?php twentytwelve_content_nav( 'nav-below' ); ?>

<?php else : ?>

<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title">Nothing Found</h1>
</header>

<div class="entry-content">
<p>Sorry, but nothing matched your search criteria. Please try again with some different keywords.</p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
<div class="content-main main-content">
<?php get_template_part( 'inc/site-search' ); ?>
</div>

<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<?php get_sidebar(); ?>
<?php endif; ?>

</div><!-- #content -->
</section><!-- #primary -->
</div>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

0 comments on commit 74110c2

Please sign in to comment.