Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to remove page name from beginning of pages but NOT from posts
Tagged: agency page titles
- This topic has 10 replies, 4 voices, and was last updated 11 years, 6 months ago by eluviis.
-
AuthorPosts
-
December 31, 2012 at 10:24 am #8598docmasMember
Was given the following code to add in response to previous inquiry on removing page name/title from top of pages which worked, but also removed them from top of posts, which I don't want to happen.
You can add this to style.css. I suggest adding it to the Headlines section.
h1.entry-title {
display: none;
}I did place it in headlines section, is there somewhere else to place or some other code to add?
Thanks,
Adam Sheck
December 31, 2012 at 2:36 pm #8628Brian BournMemberYou can add this function to your functions.php file and it will remove the automatic page title from all pages, except the blog template & will keep it on posts.
//***Remove Page Titles From All Pages Except Blog Page Template**/
add_action( 'get_header', 'bourncreative_remove_page_titles' );
function bourncreative_remove_page_titles() {
if ( is_page() && ! is_page_template( 'page_blog.php' ) )
remove_action( 'genesis_post_title', 'genesis_do_post_title' );
}You can also try the plugin Genesis Title Toggle. http://wordpress.org/extend/plugins/genesis-title-toggle/
Bourn Creative | bourncreative.com | Twitter
December 31, 2012 at 6:18 pm #8650docmasMemberI added this code and it gave me a critical syntax error, took out entire blog. Even after I deleted it, still there, which makes no sense, had to reinstall Agency. Did this twice with same result. Any suggestions?
Hate to use the Toggle plugin, which hasn't been updated in some time PLUS worried adding more plugins will slow things down.
Thoughts?
Adam
December 31, 2012 at 6:34 pm #8651Brian BournMemberProbably something to do with copy/pasting. We use this snippet on every Genesis site we build. Try grabbing it from here:
Bourn Creative | bourncreative.com | Twitter
December 31, 2012 at 10:00 pm #8670docmasMemberthanks, i'll try again, AFTER i backup the agency theme, had to reinstall it twice and then add my other customizations. hopefully no invisible characters in this one.
have the plugin installed, but as i said, less is definitely more on wordpress.
adam
March 6, 2013 at 11:35 pm #24736eluviisMemberdocmas, it's better to edit functions.php on your desktop and upload via FTP after every update. That way if you break the site with a tiny PHP error, all it takes is fixing the error in the file on your desktop and re-uploading - and all it fine with the world after that.
@Brian Bourn - I want to use that snippet, but I was originally going to apply a page ID to it to only use it on one specific page (a landing page), in my case page-ID 176.Any tips on editing that code to make it target id-176 only?
I undertand why you apply it to all pages. It's probably an SEO thing so that you can have a short page permalink, with a long H1 tag for your title. I do that sometimes by publishing the page first and then changing the title afterwards so the permalink doesn't change. However, in this case I simply want to add a <div> wrapped H1 tag in the body of the landing page itself. In order to avoid having 2 sets of H1 tags in my page, I want to remove the title (which automatically gets an H1). You think this code snippet with a little edit would do the trick?
March 7, 2013 at 6:58 am #24763frobnMemberThe page name and page id are in the body classes
Try
</pre> /* landing page */ .landing . entry-title {display:none;} <pre> /*specific page*/ .page-id-176 .entry-title {display:none; }
March 7, 2013 at 12:13 pm #24810eluviisMemberHi, oh, I know how to find the post and page id's. The CSS is relatively simple. What I'm unsure of is editing Brian Bourn's PHP code from "page template" to "page-id." What I need done has to be done via PHP and not CSS. It's not simply a display issue, it's also an SEO issue. If I hide the title using CSS, I will still have the title in the code wrapped in H1 tags. I can't have that because I want to apply H1 tags to a specific line of text in the body of my page - I'd end up with two different lines of text wrapped in H1, and you should only have 1. Using PHP to remove the title from the page will do it cleanly - also removing it from the source code of the page, not simply hiding it like CSS does. See what I mean?
March 7, 2013 at 1:58 pm #24836frobnMemberInclude the page-id # in Bourn's PHP
if ( is_page( page# )
March 7, 2013 at 2:04 pm #24840eluviisMember^ Ok great, I'll try that. Not sure what all the divs in each line are for though. I suppose I don't need to include those, right?
March 9, 2013 at 4:32 pm #25222eluviisMemberFinally got around to trying this. @frobn - That worked perfectly, thanks. (Had to get a bit of help from a friend as well) Here's the edited snippet:
//** Remove page title from About Page landing page */
add_action( 'get_header', 'bourncreative_remove_page_titles' );
function bourncreative_remove_page_titles() {
if ( is_page(176))
remove_action( 'genesis_post_title', 'genesis_do_post_title' );
} -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.