Community Forums › Forums › Archived Forums › Design Tips and Tricks › MINIMUM Theme: Adding the post and page title to page-title.php
Tagged: minimum, minimum 2.0
- This topic has 5 replies, 3 voices, and was last updated 12 years, 2 months ago by
emke.
-
AuthorPosts
-
January 23, 2013 at 9:25 am #14049
Jones
MemberHi, When opening posts and pages I want to echo the title of that page inside page-title area. Now it displays the description only.
this is what it is now:
elseif ( is_singular( 'page' ) ) {
echo '<div id="page-title"><div class="wrap"><p>' . esc_html( get_bloginfo( 'description' ) ) . '<a class="page-title-button" href="#">' . __( 'Subscribe Now', 'minimum' ) . '</a></p></div></div>';thanks in advance
January 25, 2013 at 12:14 pm #14653SoZo
MemberThat is actually rather difficult since it's outside the loop.
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
February 6, 2013 at 5:51 pm #18546emke
MemberI'm actually looking for the same thing as Jones. Any pointers on what to do?
February 7, 2013 at 5:56 am #18625Jones
MemberI managed to fix it myself, here is the solution @emke:
if ( is_home() ) {
echo '<div id="page-title"><div class="wrap"><p>' . esc_html( get_bloginfo( 'description' ) ) . '<a class="page-title-button" href="/contact">' . __( 'Neem direct contact op', 'minimum' ) . '</a></p></div></div>';
}
elseif ( is_404() ) {
echo '<div id="page-title"><div class="wrap"><p>' . __( 'Ooops!', 'minimum' ) . '<a class="page-title-button" href="/contact">' . __( 'Neem direct contact op', 'minimum' ) . '</a></p></div></div>';
}
elseif ( is_post_type_archive( 'portfolio' ) || is_singular( 'portfolio') ) {
echo '<div id="page-title"><div class="wrap"><p>' . __( 'From the Portfolio', 'minimum' ) . '<a class="page-title-button" href="/contact">' . __( 'Neem direct contact op', 'minimum' ) . '</a></p></div></div>';
}
elseif ( is_singular( 'page' ) ) {
echo '<div id="page-title"><div class="wrap"><p>' . esc_html( get_the_title($ID)) . '<a class="page-title-button" href="/contact">' . __( 'Neem direct contact op', 'minimum' ) . '</a></p></div></div>';
}
elseif ( is_singular( 'post' ) ) {
echo '<div id="page-title"><div class="wrap"><p>' . esc_html( get_the_title($ID)) . '<a class="page-title-button" href="/contact">' . __( 'Neem direct contact op', 'minimum' ) . '</a></p></div></div>';
}
elseif ( is_author() || is_category() || is_date() || is_search() || is_singular() || is_tag() ) {
echo '<div id="page-title"><div class="wrap"><p>' . __( 'From the Blog', 'minimum' ) . '<a class="page-title-button" href="/contact">' . __( 'Neem direct contact op', 'minimum' ) . '</a></p></div></div>';
}
else {
echo '<div id="page-title"><div class="wrap"><p>' . esc_html( get_bloginfo( 'description' ) ) . '<a class="page-title-button" href="/contact">' . __( 'Neem direct contact op', 'minimum' ) . '</a></p></div></div>';
}This displays the page title at pages and posts. Its translated so dont mind the 'neem direct contact op'
let me know if this helped you
February 7, 2013 at 4:53 pm #18774emke
MemberYeah, I also managed to get it to work in the mean time. Thanks for your help! 🙂
February 8, 2013 at 6:08 pm #19121emke
MemberHi,
so I have a problem I cannot figure out how to solve. On my blog page I get the last post title in my page-title area. I would like to have only "Blog" or what ever as the blog page is showing several posts and not only the last one. This is the code I currently have:
<?php
if ( is_home() ) {
echo '<div id="page-title"><div class="wrap"><h1>' . esc_html( get_the_title($ID)) . '</h1><a class="page-title-button" href="/contact">' . __( 'Contact', 'minimum' ) . '</a></div></div>';
}
elseif ( is_404() ) {
echo '<div id="page-title"><div class="wrap"><h1>' . __( 'Ooops!', 'minimum' ) . '</h1><a class="page-title-button" href="/contact">' . __( 'Contact', 'minimum' ) . '</a></div></div>';
}
elseif ( is_singular( 'page' ) ) {
echo '<div id="page-title"><div class="wrap"><h1>' . esc_html( get_the_title($ID)) . '</h1><a class="page-title-button" href="/contact">' . __( 'Contact', 'minimum' ) . '</a></div></div>';
}
elseif ( is_singular( 'post' ) ) {
echo '<div id="page-title"><div class="wrap"><h1>' . esc_html( get_the_title($ID)) . '</h1><a class="page-title-button" href="/contact">' . __( 'Contact', 'minimum' ) . '</a></div></div>';
}
elseif ( is_author() || is_category() || is_date() || is_search() || is_singular() || is_tag() ) {
echo '<div id="page-title"><div class="wrap"><h1>' . __( 'From the Blog', 'minimum' ) . '</h1><a class="page-title-button" href="/contact">' . __( 'Contact', 'minimum' ) . '</a></div></div>';
}
else {
echo '<div id="page-title"><div class="wrap"><h1>' . esc_html( get_bloginfo( 'description' ) ) . '</h1><a class="page-title-button" href="/contact">' . __( 'Contact', 'minimum' ) . '</a></div></div>';
}I've tried adding:
}
elseif ( is_blog() ) {
echo '<div id="page-title"><div class="wrap"><h1>' . __( 'Ooops!', 'minimum' ) . '</h1><a class="page-title-button" href="/contact">' . __( 'Contact', 'minimum' ) . '</a></div></div>';
}but then nothing works. Can anyone help me out please?
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.