Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify page title Close #36 #38

Merged
merged 1 commit into from Dec 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions 404.php
Expand Up @@ -14,8 +14,8 @@

<section class="error-404 not-found">
<?php
// Print of the page header of no posts and 404 page.
colorful_no_post_header();
// Print of the page header.
colorful_post_header();

// Print of the content of no posts and 404 page.
colorful_no_post_content();
Expand Down
11 changes: 3 additions & 8 deletions archive.php
Expand Up @@ -13,16 +13,11 @@
<main id="main" class="site-main" role="main">

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

<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="archive-description">', '</div>' );
?>
</header><!-- .page-header -->
// Print of the page header.
colorful_post_header();

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

Expand Down
14 changes: 9 additions & 5 deletions inc/functions/functions-posts.php
Expand Up @@ -123,18 +123,22 @@ function colorful_entry_content_excerpt() {
endif;

/**
* Print of the page header of no posts and 404 page.
* // Print of the page header.
*/
if ( ! function_exists( 'colorful_no_post_header' ) ) :
function colorful_no_post_header() {
if ( is_404() ) {
if ( ! function_exists( 'colorful_post_header' ) ) :
function colorful_post_header() {
if ( is_search() ) {
$pege_title_text = sprintf( __( 'Search Results for: %s', 'colorful' ), '<span>' . get_search_query() . '</span>' );
} else if ( is_archive() ) {
$pege_title_text = get_the_archive_title();
} else if ( is_404() ) {
$pege_title_text = __( '404 Not found', 'colorful' );
} else {
$pege_title_text = __( 'Nothing Found', 'colorful' );
}

echo '<header class="page-header">' . "\n";
echo '<h1 class="page-title">' . esc_attr( $pege_title_text ) . '</h1>' . "\n";
echo '<h1 class="page-title">' . wp_kses( $pege_title_text, array( 'span' => array( 'class' => array() ) ) ) . '</h1>' . "\n";
echo '</header>' . "\n";
}
endif;
Expand Down
8 changes: 3 additions & 5 deletions search.php
Expand Up @@ -13,13 +13,11 @@
<main id="main" class="site-main" role="main">

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

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

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

Expand Down
4 changes: 2 additions & 2 deletions template-parts/content-none.php
Expand Up @@ -10,8 +10,8 @@

<section class="no-results not-found">
<?php
// Print of the page header of no posts and 404 page.
colorful_no_post_header();
// Print of the page header.
colorful_post_header();

// Print of the content of no posts and 404 page.
colorful_no_post_content();
Expand Down