Community Forums › Forums › Archived Forums › Design Tips and Tricks › Remove post title hook removed titles sitewide!
- This topic has 16 replies, 3 voices, and was last updated 10 years, 2 months ago by
Tonya.
-
AuthorPosts
-
February 12, 2015 at 10:01 am #140608
nhed
MemberHi everyone.
I am using this hook to remove page titles:
//* Remove all post titles remove_action('genesis_entry_header', 'genesis_do_post_title');
I also added this hook to remove the post info:
//* Remove the entry meta in the entry header (requires HTML5 theme support) remove_action( 'genesis_entry_header', 'genesis_post_info', 5 );
But now it appears that the titles are removed on the pages as well. Pages such as the Archive and Sample pages are without a headline.
It may look as if the title is just under the header/nav bar area, but it's not.
I'm also having problems with the padding and extra white space in the mobile responsive widths and not enough space in full width pages but that's for another thread. 馃檪I'd appreciate some help on this if possible.
Ed
http://join-ed.com/sample/February 12, 2015 at 3:32 pm #140649Tonya
MemberHi Ed,
Let's see if I can help you out.
1) Lower down the page content so that it's not hidden under the header/navbar:
If you go to line 549 of your style.css, you'll find that the margin-top being applied to .site-inner is very small. Your header's height is 77px. Therefore, you should have at least 100px here or more.
2) Page & Post titles: I assume that you want to hide these on the home and front-page. Correct? I'm assuming there is a front-page.php file in your theme. If yes, then you can simply put the 2 hooks in there as part of the "genesis_meta" callback, e.g.:
add_action( 'genesis_meta', 'altitude_front_page_genesis_meta' ); function altitude_front_page_genesis_meta() { //* Remove all post titles remove_action('genesis_entry_header', 'genesis_do_post_title'); }
If you'd prefer to do it in the functions.php file, then you would add a conditional such as:
add_action( 'genesis_meta', 'altitude_genesis_meta' ); function altitude_genesis_meta() { if (is_home() || is_front_page()) { //* Remove all post titles remove_action('genesis_entry_header', 'genesis_do_post_title'); } }
Cheers,
Tonya
Software & Electrical Engineer and Programming Teacher 路 I’m on a mission to help developers be more awesome.
Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer BootcampFebruary 13, 2015 at 3:40 am #140684nhed
MemberThank you Tonya. I'm very thankful for the help.
Regarding issue 1: Yes! I changed the padding to 100p and everything works great now, even in the mobile widths!! Thank you, thank you, thank you.
Please see this to be sure you know how thankful I am:
Regarding issue 2: The Front-Page (home page) isn't an issue. Apparently there is no title on the front page as far as I can see. I haven't started working on the Front-page yet, but it seems to be OK the way it is.
My problem is that the code that was suggested to me to add to remove the title from posts apparently also is removing the title from pages too.
Will what you are suggesting above bring back the title area on pages too?
Thank you sooooo much for the help. I truly appreciate it Tonya.
All the best.
Ed
February 13, 2015 at 3:46 am #140686nhed
MemberI apologize for the video above. I only meant to post the link, I didn't know the actual video would show up. But thank you all for your help.
February 13, 2015 at 3:54 am #140687Tonya
MemberHello Ed,
You just caught me before I turned in for the night (or actually wee hours of the morning). The video cracked me up! Thank you. And you're welcome too.
Ah I understand now on the page titles. To bring back the titles on pages, simply wrap the removes in a conditional is_single(), ie
if (is_single()) { //* the removes here }
Now the removes will only execute on posts and not pages. To condition on pages, use is_page().
Off to dreamland now. Happy coding,
Tonya
Software & Electrical Engineer and Programming Teacher 路 I’m on a mission to help developers be more awesome.
Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer BootcampFebruary 13, 2015 at 8:57 am #140694nhed
MemberHi Tonya,
Thanks for the thanks. Have a great day.
I tried the code you suggested to add to the php file. Here's the code at the bottom of my functions.php file:
if (is_single()) { //* Remove all post titles remove_action('genesis_entry_header', 'genesis_do_post_title'); } //* Remove the entry meta in the entry header (requires HTML5 theme support) remove_action( 'genesis_entry_header', 'genesis_post_info', 5 );
But...
Now the titles are back on all my pages, that's good. But the titles are back on the posts as well.
So now what do I do?
Thanks for the help. And...
I read all about you on your site. I happy to meet you and so glad He save you.
All the best,
Ed
February 13, 2015 at 12:50 pm #140728Tonya
MemberHi Ed,
That's what I get for writing you at 4am when I'm heading off to sleep (I have a weird schedule). Here is the entire code to add to your functions.php file:
add_action('genesis_meta', 'callback_remove_post_info_and_post_titles'); /** * Remove post info and post titles * * @since 1.0.0 * * @return void */ function callback_remove_post_info_and_post_titles() { if ( is_single() ) { //* Remove all post titles remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); remove_action( 'genesis_post_title', 'genesis_do_post_title' ); } //* Remove the post info remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); remove_action( 'genesis_before_post_content', 'genesis_post_info' ); }
You'll see that I added both the pre-HTML5 & HTML5 actions within the function. You want to hook into genesis_meta to ensure the conditional is grabbed at the right time.
Thank you for your kind words and checking out my blog and about page. 馃檪 Life is an amazing ride!
Let me know if this works for you. Otherwise, PM me and I can take a look on your site to help out.
Cheers,
Tonya
Software & Electrical Engineer and Programming Teacher 路 I’m on a mission to help developers be more awesome.
Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer BootcampFebruary 13, 2015 at 4:12 pm #140774nhed
MemberHey thanks so much, Tonya.
Now you will know how newbie I am.
How do I PM you? I just used the contact form on your site, and I've looked around here for PM but don't seem to see it.
All the best,
Ed
February 13, 2015 at 4:27 pm #140777Tonya
MemberHey Ed,
Got your email and I just sent you one back. Now the fun begins...
Software & Electrical Engineer and Programming Teacher 路 I’m on a mission to help developers be more awesome.
Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer BootcampFebruary 13, 2015 at 5:06 pm #140782Tonya
MemberAll fixed for you, Ed. Get some rest 馃檪
Software & Electrical Engineer and Programming Teacher 路 I’m on a mission to help developers be more awesome.
Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer BootcampFebruary 17, 2015 at 9:34 pm #141159savingatthelake
MemberHi! I have been curious about this myself. I have seen on many sites where there is no title, instead there is a image with the title. That is what I am trying to achive. 2 questions:
1. If I remove the title in php. folder, will the title (SEO) still be picked up on the web?
2. I tried the following code that you gave nhed. It worked, except I would like for all of my titles to be gone, even on my archive posts. What code would I need? Thanks!
add_action( 'genesis_meta', 'altitude_genesis_meta' );
function altitude_genesis_meta()
{
if (is_home() || is_front_page())
{
//* Remove all post titles
remove_action('genesis_entry_header', 'genesis_do_post_title');
}
}~Paige becomingbeautiful.org
February 18, 2015 at 2:31 pm #141240Tonya
MemberHello Paige,
You can get rid of the conditionals and just have the following:
add_action('genesis_meta', 'callback_remove_all_post_titles'); /** * Remove post titles on all pages * * @since 1.0.0 * * @return void */ function callback_remove_all_post_titles() { //* Remove all post titles remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); remove_action( 'genesis_post_title', 'genesis_do_post_title' ); }
Software & Electrical Engineer and Programming Teacher 路 I’m on a mission to help developers be more awesome.
Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer BootcampFebruary 18, 2015 at 3:09 pm #141243nhed
MemberThank you Tonya. I wasn't sure what to say to answer Paige. So thank you once again.
Later I need to talk with you. I'll write you directly later in the week. Actually, probably on the weekend. 馃檪
And Paige, I'm glad you got the help you needed.
All the best.
Ed
February 19, 2015 at 6:55 pm #141385savingatthelake
MemberThank you for your speedy reply!
When I added this to my functions.php my whole site went blank. I had to go to my hosting site to remove the code from that file to make my site work again. Any ideas what I did wrong?
February 19, 2015 at 7:08 pm #141386Tonya
MemberWhen you insert into your functions.php file, you need to make sure a few things:
1) No closing ?> at the bottom of the file. From StudioPress, there isn't one there, but just check to make sure.
Note: It doesn't hurt to have it; however, it's far too easy to have blank spaces and extra content after the closing PHP tag (which will make your screen go back or toss an error. Therefore, we always work without it.2) Make sure the code looks exactly like the code above BEFORE you save the file, i.e. no weird characters (which can happen when copying and pasting).
3) Put it at the bottom of the file.
4) Make sure there are no extra blank lines at the bottom of the file. The last line should be the closing brace from the code above.
Some other tips:
1) It's best to work with a backup of the file and then transfer it to your web host instead of working directly in the WordPress Editor. Why? Because you make an error and not be able to recover quickly. Or you may want to revert back quickly.
2) Always backup the file that is going to be edited before you make a change to it. Then you have the file in its working state ready to go should you need to revert back.
Cheers,
Tonya
Software & Electrical Engineer and Programming Teacher 路 I’m on a mission to help developers be more awesome.
Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer BootcampFebruary 20, 2015 at 1:34 pm #141535nhed
MemberHi Savingatthelake,
I now use Notepad++ to avoid strange things creeping into my code. It's got a plugin that I use to compare one file with another one. It has been a tremendous help to me as I make changes. I can go back and compare my css or php file with the original theme files or compare them with the most recent save.
All the best with your site. You're doing great. And it looks like a lot of work, keeping up with all the weekly sales.
Ed
February 20, 2015 at 1:37 pm #141536Tonya
MemberHappy Friday Paige,
If you need me to take a closer look at it, contact me here.
Cheers,
Tonya
Software & Electrical Engineer and Programming Teacher 路 I’m on a mission to help developers be more awesome.
Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer Bootcamp -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.