Created
September 2, 2014 11:28
-
-
Save bichotll/d29d2db9be78950241eb to your computer and use it in GitHub Desktop.
shitty wp code - breadcrumb
This file contains hidden or 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
function the_breadcrumb() { | |
global $post; | |
//var_dump($post); | |
echo '<ol class="breadcrumb" id="breadcrumbs">'; | |
if (is_front_page() && !is_home()) { | |
echo '<li><a href="'; | |
echo get_option('home'); | |
echo '">'; | |
echo _e('Home'); | |
echo "</a></li>"; | |
} else if (is_home() && !is_front_page()) { | |
echo '<li><a href="'; | |
echo get_option('home'); | |
echo '">'; | |
echo _e('Home'); | |
echo "</a></li>"; | |
echo '<li>'; | |
echo "<a href='"; | |
if ($post->post_type === 'post') { | |
if (get_option('show_on_front') == 'page') | |
echo get_permalink(get_option('page_for_posts')); | |
else | |
echo bloginfo('url'); | |
echo "'>"; | |
echo _e('Actualidad'); | |
} else { | |
echo "<a href='" . get_post_type_archive_link($post->post_type) . "'>"; | |
echo ucwords($post->post_type); | |
} | |
echo '</a></li>'; | |
} else if (!is_home() && !is_front_page()) { | |
if (!is_home()) { | |
echo '<li><a href="'; | |
echo get_option('home'); | |
echo '">'; | |
echo _e('Home'); | |
echo "</a></li>"; | |
if (is_category() && !is_page() || is_single() && !is_page()) { | |
echo '<li>'; | |
echo "<a href='"; | |
if ($post->post_type === 'post') { | |
if (get_option('show_on_front') == 'page') | |
echo get_permalink(get_option('page_for_posts')); | |
else | |
echo bloginfo('url'); | |
echo "'>"; | |
echo _e('Actualidad'); | |
} else { | |
echo "<a href='" . get_post_type_archive_link($post->post_type) . "'>"; | |
echo ucwords($post->post_type); | |
} | |
echo '</a></li>'; | |
echo '<li>'; | |
if (is_single()) { | |
the_title(); | |
echo '</li>'; | |
} | |
} elseif (is_page()) { | |
if ($post->post_parent) { | |
$anc = get_post_ancestors($post->ID); | |
$title = get_the_title(); | |
foreach ($anc as $ancestor) { | |
$output = '<li><a href="' . get_permalink($ancestor) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>'; | |
} | |
echo $output; | |
echo '<li title="' . $title . '"> ' . $title . '</li>'; | |
} else { | |
echo '<li>' . get_the_title() . '</li>'; | |
} | |
} | |
} elseif (is_tag()) { | |
single_tag_title(); | |
} elseif (is_day()) { | |
echo"<li>Archive for "; | |
the_time('F jS, Y'); | |
echo'</li>'; | |
} elseif (is_month()) { | |
echo"<li>Archive for "; | |
the_time('F, Y'); | |
echo'</li>'; | |
} elseif (is_year()) { | |
echo"<li>Archive for "; | |
the_time('Y'); | |
echo'</li>'; | |
} elseif (is_author()) { | |
echo"<li>Author Archive"; | |
echo'</li>'; | |
} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { | |
echo "<li>Blog Archives"; | |
echo'</li>'; | |
} elseif (is_search()) { | |
echo"<li>Search Results"; | |
echo'</li>'; | |
} | |
} else { | |
echo "<li><a></a></li>"; | |
} | |
echo '</ol>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment