Created
May 19, 2014 12:13
-
-
Save philipjohn/6ad362367f37a253094d to your computer and use it in GitHub Desktop.
For testing duplication suspect bug in Facetious
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Facetious Bug Test | |
* Description: Just testing | |
* Author: Code For The People | |
*/ | |
function fbt_taxos() { | |
register_extended_taxonomy( 'doc-type', 'attachment' ); | |
register_extended_taxonomy( 'part', 'attachment' ); | |
register_extended_taxonomy( 'doc-language', 'attachment' ); | |
} | |
add_action( 'init', 'fbt_taxos' ); | |
function fbt_attachments_search_pre_get_posts( $query ) { | |
if ( ! is_search() ) | |
return $query; | |
// add post type attachment | |
$post_types = $query->get( 'post_type' ); | |
if ( ! $post_types || 'post' == $post_types ) | |
$post_types = array( 'post', 'attachment' ); | |
if ( is_array( $post_types ) ) | |
$post_types[] = 'attachment'; | |
$query->set( 'post_type', $post_types ); | |
// add post status 'inherit' | |
$post_status = $query->get( 'post_status' ); | |
if ( ! $post_status || 'publish' == $post_status ) | |
$post_status = array( 'publish', 'inherit' ); | |
if ( is_array( $post_status ) ) | |
$post_status[] = 'inherit'; | |
$query->set( 'post_status', $post_status ); | |
return $query; | |
} | |
// hook our function to the filter | |
add_filter( 'pre_get_posts', 'fbt_attachments_search_pre_get_posts' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The default template for displaying content | |
* | |
* Used for both single and index/archive/search. | |
* | |
* @package WordPress | |
* @subpackage Twenty_Fourteen | |
* @since Twenty Fourteen 1.0 | |
*/ | |
?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
<div class="entry-summary"> | |
<?php echo wp_get_attachment_url( get_the_ID() ); ?> | |
</div><!-- .entry-summary --> | |
<?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?> | |
</article><!-- #post-## --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The template for displaying Search Results pages | |
* | |
* @package WordPress | |
* @subpackage Twenty_Fourteen | |
* @since Twenty Fourteen 1.0 | |
*/ | |
get_header(); ?> | |
<section id="primary" class="content-area"> | |
<div id="content" class="site-content" role="main"> | |
<!-- Hello?! --> | |
<?php | |
$args = array( | |
'search' => __('Search'), | |
'fields' => array( | |
's' => array( | |
'label' => 'Enter a keyword', | |
), | |
'doc-type' => array( | |
'label' => 'Type of document', | |
'all' => 'All types', | |
), | |
'part' => array( | |
'label' => 'Part', | |
'all' => 'All parts', | |
), | |
'doc-language' => array( | |
'label' => 'Language', | |
'all' => 'Both languages', | |
), | |
'm', | |
), | |
); | |
do_action( 'facetious', $args ); | |
?> | |
<?php if ( have_posts() ) : ?> | |
<header class="page-header"> | |
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyfourteen' ), get_search_query() ); ?></h1> | |
</header><!-- .page-header --> | |
<?php | |
// Start the Loop. | |
while ( have_posts() ) : the_post(); | |
/* | |
* Include the post format-specific template for the content. If you want to | |
* use 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', 'attachment' ); | |
endwhile; | |
// Previous/next post navigation. | |
twentyfourteen_paging_nav(); | |
else : | |
// If no content, include the "No posts found" template. | |
get_template_part( 'content', 'none' ); | |
endif; | |
?> | |
</div><!-- #content --> | |
</section><!-- #primary --> | |
<?php | |
get_sidebar( 'content' ); | |
get_sidebar(); | |
get_footer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Theme Name: Facetious Bug Test Theme | |
Author: Code For The People | |
Description: Just testin' | |
Template: twentyfourteen | |
*/ | |
@import url('../twentyfourteen/style.css'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment