Support Forums for LiveMesh Themes & Plugins › Forums › Appdev Theme Support › Have Page Title Appear for Blog Posts not Pages
- This topic has 3 replies, 2 voices, and was last updated 10 years, 11 months ago by Raghavendra.
-
AuthorPosts
-
February 25, 2014 at 2:56 pm #4825toddbialaMember
is it possible to have the page title to display only for blogposts and not for pages. I don’t want the extra h1 on the page for pages. I believe have to edit in post-functions.php?
if (!function_exists(‘mo_get_entry_title’)) {
function mo_get_entry_title() {
global $post;if (is_front_page() && !is_home())
$title = the_title(‘<h2 class=”‘ . esc_attr($post->post_type) . ‘-title entry-title”><a href=”‘ . get_permalink() . ‘”
title=”‘ . get_the_title() . ‘”
rel=”bookmark”>’, ‘</h2>’,
false);
elseif (is_singular())
$title = the_title(‘<h1 class=”‘ . esc_attr($post->post_type) . ‘-title entry-title”>’, ‘</h1>’, false);
else
$title = the_title(‘<h2 class=”entry-title”><a href=”‘ . get_permalink() . ‘” title=”‘ . get_the_title() . ‘”
rel=”bookmark”>’, ‘</h2>’, false);/* If there’s no post title, return a default title */
if (empty($title)) {
if (!is_singular()) {
$title = ‘<h2 class=”entry-title no-entry-title”>‘ . __(‘(Untitled)’,
‘mo_theme’) . ‘</h2>’;
}
else {
$title = ‘<h1 class=”entry-title no-entry-title”>’ . __(‘(Untitled)’, ‘mo_theme’) . ‘</h1>’;
}
}return $title;
}
}February 26, 2014 at 12:45 pm #4845RaghavendraModeratorIf you do not want to change the code, you can just input a empty span element into Custom HTML area of the Custom Heading options in the Page edit window. If you do not have more than a few pages, I would prefer this approach.
Otherwise, you can do a Custom CSS in theme options –
#title-area { display: none; }
or last – change the code above to add an extra if condition (it needs to be the second one to work right before the is_singular check ) in the above function –
elseif (is_singular('page')) $title = '';
February 26, 2014 at 6:10 pm #4863toddbialaMemberAwesome. One more question. What would be best way to get phone number to display instead of page title and not in h1?
February 27, 2014 at 12:33 pm #4881RaghavendraModeratorI am assuming you want to display phone number where page title is being displayed. The approach would be same as above. You can enter the phone number in the Custom Heading Content part of Custom Header Options in the page edit window or you can return the phone number HTML instead of spans in the above if condition.
elseif (is_singular('page')) $title = 'Phone: 913-908-9876';
I do not know your usecase, but in general, if you want the phone number to show up in all pages, you can just drop a text widget with phone number content in the Header or Footer widget area (will need the latest version of Appdev for the Header widget area). Hope this helps.
-
AuthorPosts
- The forum ‘Appdev Theme Support’ is closed to new topics and replies.