Skip to content

Instantly share code, notes, and snippets.

@hsquareweb
Created September 12, 2013 17:31
Show Gist options
  • Select an option

  • Save hsquareweb/6541120 to your computer and use it in GitHub Desktop.

Select an option

Save hsquareweb/6541120 to your computer and use it in GitHub Desktop.
WP: Parent Titles
//Pull the section title "parent" except the homepage.
<?php if (!is_front_page()) { ?>
<h1 class="section-title inner">
<?php
if (is_page()) {
$parent_title = get_the_title($post->post_parent);
echo $parent_title;
}
elseif ( (is_singular('latest-news') || is_post_type_archive('latest-news')) ) {
echo 'Latest News <a href="';
site_url();
echo '/feed/?post_type=latest-news" title="Subscribe to our Latest News" class="feed"><img src="';
bloginfo('stylesheet_directory');
echo '/images/icon-feed.png" alt="RSS Feed"/></a>';
}
elseif ( (is_singular('case-studies') || is_post_type_archive('case-studies')) ) {
echo "Case Studies";
}
elseif (is_404()) {
echo "";
}
elseif ( (is_blog_installed() || is_single() || is_archive()) ) {
echo 'Blog <a href="';
bloginfo('rss2_url');
echo '" title="Subscribe to the ACDi Blog" class="feed"><img src="';
bloginfo('stylesheet_directory');
echo '/images/icon-feed.png" alt="RSS Feed"/></a>';
}
else {
echo "";
}
?>
</h1>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment