Skip to content

Commit

Permalink
Some fix and improvements
Browse files Browse the repository at this point in the history
+ Add commented line in custom-post-type.php
+ Fix display description for CPT in Archive page archive.php line 34,
now display description for all custom post without type slug
+ Fix ID's name for author.php (chage in author-page)
+ Add <?php create_breadcrumbs() ?> to search.php
+ Improve breacrumb.php, now show custom_post_type name
+ Improve Read more link in excerpt function (custom_excerpt.php)
+ Fix domain name in single.php
  • Loading branch information
overclokk committed Aug 3, 2014
1 parent 6538d38 commit 9a21abd
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 40 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ http://www.overclokk.net/italystrap-wordpress-starter-theme

##Changelog

###1.8.7

+ Add commented line in custom-post-type.php
+ Fix display description for CPT in Archive page archive.php line 34, now display description for all custom post without type slug
+ Fix ID's name for author.php (chage in author-page)
+ Add <?php create_breadcrumbs() ?> to search.php
+ Improve breacrumb.php, now show custom_post_type name
+ Improve Read more link in excerpt function (custom_excerpt.php)
+ Fix domain name in single.php

###1.8.6

+ Change loop in file blog.php, now pagination and excerpt works well
Expand Down
2 changes: 1 addition & 1 deletion archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// Display or retrieve title for a post type archive.
// This is optimized for archive.php and archive-{posttype}.php template files for displaying the title of the post type.
?><h2 itemprop="headline"><?php post_type_archive_title(); ?></h2>
<?php $cpt_description = get_post_type_object( 'prodotti' );
<?php $cpt_description = get_post_type_object( get_post_type() );
if ($cpt_description) : ?>
<div class="alert alert-info" role="alert" itemprop="description">
<?php echo $cpt_description->description ;?>
Expand Down
2 changes: 1 addition & 1 deletion author.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php get_header(); ?>
<section id="author">
<section id="author-page">
<div class="container">
<div class="row">
<div class="col-md-8">
Expand Down
58 changes: 41 additions & 17 deletions lib/breadcrumb.php
Original file line number Diff line number Diff line change
@@ -1,50 +1,74 @@
<?php
function create_breadcrumbs() { //http://mkoerner.de/breadcrumbs-for-wordpress-themes-with-bootstrap-3/
if(!is_home()) {
/**
* @link http://mkoerner.de/breadcrumbs-for-wordpress-themes-with-bootstrap-3/
* Bootstrap breadcrumbs for wordpress modified by Enea Overclokk
*/
function create_breadcrumbs() {

global $post;
$categories = get_the_category($post->ID);

if(!is_home() || !is_front_page()) {

echo '<div itemscope itemtype="http://schema.org/WebPage"><ol class="breadcrumb" itemprop="breadcrumb">';
echo '<li><a href="' . home_url() . '">Home</a></li>';

if (is_single()) {
echo '<li>';
the_category(', ');
echo '</li>';
if (is_single()) {

if ( !empty($categories)) {
echo '<li>';
the_title();
the_category(', ');
echo '</li>';
}

if (is_single()) {
echo '<li>' . get_the_title() . '</li>';
}

} elseif (is_category()) {
echo '<li>';
single_cat_title();
echo '</li>';
} elseif (is_page() && (!is_front_page())) {

} elseif (is_post_type_archive()) {
echo '<li>';
the_title();
post_type_archive_title();
echo '</li>';

} elseif (is_page() && (!is_front_page())) {
echo '<li>' . get_the_title() . '</li>';

} elseif (is_tag()) {
echo '<li>Tag: ';
echo '<li>' . __('Tag: ', 'ItalyStrap');
single_tag_title();
echo '</li>';

} elseif (is_day()) {
echo'<li>Archive for ';
echo'<li>'. __('Archive for ', 'ItalyStrap');
the_time('F jS, Y');
echo'</li>';

} elseif (is_month()) {
echo'<li>Archive for ';
echo'<li>'. __('Archive for ', 'ItalyStrap');
the_time('F, Y');
echo'</li>';

} elseif (is_year()) {
echo'<li>Archive for ';
echo'<li>' . __('Archive for ', 'ItalyStrap');
the_time('Y');
echo'</li>';

} elseif (is_author()) {
echo'<li>Author Archives';
echo'</li>';
echo'<li>' . __('Author Archives', 'ItalyStrap') . '</li>';

} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
echo '<li>Blog Archives';
echo '<li>' . __('Blog Archives', 'ItalyStrap');
echo'</li>';

} elseif (is_search()) {
echo'<li>Search Results';
echo'<li>' . __('Search Results', 'ItalyStrap');
echo'</li>';

}
echo '</ol></div>';
}
Expand Down
3 changes: 3 additions & 0 deletions lib/custom-post-type.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php
/**
* Register your own Custom Post Type in this file
*
* Remeber to regenerate permalink in /wp-admin/options-permalink.php?settings-updated=true
*
* @link http://codex.wordpress.org/Function_Reference/register_post_type
* @link http://melchoyce.github.io/dashicons/
*
Expand Down
88 changes: 70 additions & 18 deletions lib/custom_excerpt.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,72 @@
<?php
//Definisco la lunghezza massima excerpt
function custom_excerpt_length( $length ) {
if ( is_home() || is_front_page() ){
return 30;}
else{
return 50;
}
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 20 );

function new_excerpt_more( $more ) {
if ( is_home() || is_front_page() ){
return '';}
else{
return ' <a href="'. get_permalink() . '">... Continua a leggere</a>';
<?php
/**
* New function to set excerpt lenght and show "more link"
* @link http://stackoverflow.com/questions/10081129/why-cant-i-override-wps-excerpt-more-filter-via-my-child-theme-functions
*
* Codex link:
* @link http://codex.wordpress.org/Excerpt
* @link http://codex.wordpress.org/Customizing_the_Read_More
*/

add_action( 'after_setup_theme', 'italystrap_excerpt_more_lenght' );

if ( !function_exists( 'italystrap_excerpt_more_lenght' ) ):

function italystrap_excerpt_more_lenght() {

// Escerpt read more link function
function italystrap_read_more_link() {

return $read_more_link = ' <a href="'. get_permalink() . '">... ' . __( 'Read more', 'ItalyStrap' ) . '</a>';

}
// Function to override
function italystrap_custom_excerpt_more( $output ) {

if ( has_excerpt() && !is_attachment() ) {
$output .= italystrap_read_more_link();
}
return $output;

}

add_filter( 'get_the_excerpt', 'italystrap_custom_excerpt_more' );
add_filter( 'excerpt_more', 'italystrap_read_more_link' );

// Excerpt lenght function
function italystrap_excerpt_length( $length ) {

if ( is_home() || is_front_page() ) {
return 25;
}else{
return 50;
}
}
add_filter( 'excerpt_length', 'italystrap_excerpt_length' );

}
}
add_filter('excerpt_more', 'new_excerpt_more');
endif; // italystrap_excerpt_more_lenght


/**
* Function deprecated
*
*/
// function custom_excerpt_length( $length ) {
// if ( is_home() || is_front_page() ){
// return 30;}
// else{
// return 50;
// }
// }
// add_filter( 'excerpt_length', 'custom_excerpt_length', 20 );

// function new_excerpt_more( $more ) {
// if ( is_home() || is_front_page() ){
// return '';}
// else{
// return ' <a href="'. get_permalink() . '">... Continua a leggere</a>';
// }
// }
// add_filter('excerpt_more', 'new_excerpt_more');
?>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Ottimizzazione landing corsi",
"author": "Enea Overclokk",
"homepage": "http://www.overclokk.net/italystrap",
"version": "1.8.6",
"version": "1.8.7",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-uglify": "~0.4.0",
Expand Down
1 change: 1 addition & 0 deletions search.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<div class="container">
<div class="row">
<div class="col-md-8" itemscope itemtype="http://schema.org/SearchResultsPage">
<?php create_breadcrumbs() ?>
<?php
if ( have_posts() ) : ?>

Expand Down
2 changes: 1 addition & 1 deletion single.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<?php } ?>
<div itemprop="articleBody"><?php the_content(); ?></div>
<?php wp_link_pages( array(
'before' => '<p class="text-muted lead"><b>' . __( 'Pages:', 'italystrap' ) . '</b>',
'before' => '<p class="text-muted lead"><b>' . __( 'Pages:', 'ItalyStrap' ) . '</b>',
'after' => '</p>',
) );?>
<p class="label label-info">Ultima modifica: <time datetime="<?php the_modified_time('Y-m-d') ?>" itemprop="dateModified"><?php the_modified_time('d F Y') ?></time></p>
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Theme URI: http://www.overclokk.net/italystrap-wordpress-starter-theme
Author: Enea Overclokk
Author URI: http://www.overclokk.net
Description: Wordpess starter theme with twitter bootstrap, HTML5 boilerplate and Schema.org <a href="https://github.com/overclokk/ItalyStrap/graphs/contributors">Contribute on GitHub</a>
Version: 1.8.6
Version: 1.8.7
License: MIT License (MIT)
License URI: http://opensource.org/licenses/MIT
Tags: right-sidebar, featured-images, full-width-template, microdata
Expand Down

0 comments on commit 9a21abd

Please sign in to comment.