Community Forums › Forums › Archived Forums › Design Tips and Tricks › Header snippet
- This topic has 12 replies, 3 voices, and was last updated 11 years, 8 months ago by
DavidF.
-
AuthorPosts
-
June 1, 2013 at 1:13 am #43436
DavidF
MemberHi All,
I want to add a header to a Premise landing page.
Does anyone know the correct header snippet I should add to my custom code?
Thanks
David
June 1, 2013 at 1:28 am #43438Mahesh
MemberTaken from genesis code snippets. Brian also has code snippets.
/** Add support for custom header */
add_theme_support(
'genesis-custom-header'
,
array
(
'width'
=> 960,
'height'
=> 100 ) );
June 1, 2013 at 5:52 am #43446Brad Dalton
ParticipantIf you want all landing pages to use a header, you can simply remove this coce from the landing page template in your child theme.
// Remove header, navigation, breadcrumbs, footer widgets, footer remove_action( 'genesis_header', 'genesis_header_markup_open', 5 ); remove_action( 'genesis_header', 'genesis_do_header' ); remove_action( 'genesis_header', 'genesis_header_markup_close', 15 );
Or you can copy the existing landing page, rename it and rename the file name and remove the above code so you can then choose from 2 landing pages to use.
One with a header and one without.
June 1, 2013 at 3:43 pm #43513DavidF
MemberThanks for these post but I couldn't get them working.
What I want to do is just add a header or a div to my "landing" page only.
I tried using simple hooks but it applies the my code on all pages even when using code to show on the home page it seems to not tak that rule when premise landing page is set as the home page.
Thanks for any help.
June 1, 2013 at 9:58 pm #43558Brad Dalton
ParticipantJune 2, 2013 at 2:40 am #43585DavidF
MemberI'm using Epik theme for the blog but Premise landing page is the static home page.
Premise has a custom function option to insert code for this reason but their support didn't help first time around. I might go back to them.
Thanks
David
June 2, 2013 at 3:52 am #43588Brad Dalton
ParticipantI tested this code David and it works:
You will need to grab the page i.d from the source code and replace the 007 in the code with your own.
Another option is to replace the conditional tag with:
if ( is_front_page () ) or if ( is_home () )
Code not displaying? Grab it on Github.
You can then insert your header image in a new post draft and grab the HTML for the image which needs to be replaced in between the div tags.
You can style the header using the new class and also use the advanced image settings to style the image.
You could even add the header image using CSS code.
June 3, 2013 at 3:16 am #43776DavidF
MemberThanks Brad.
It's not working, I tried all option of post id home and front page. I have this in my Premise custom functions area:
<?php function add_header_specific_page() {
if(is_page(750) )
echo '<img class="aligncenter size-full wp-image-32533" alt="header" src="http://127.0.0.1:4001/wordpress/wp-content/uploads/2013/06/header1.png" width="700" height="69" />';
}
/**
* @author Brad Dalton - WP Sites
* @learn more http://wpsites.net
*/
add_action('genesis_header', 'add_header_specific_page');
?>Even viewing the source I don't see the image inserted. So to clarify I'm adding just a header to Premise landing page 750 and leave all other stuff in place. I'll ask Premise support as well.
Dave
June 3, 2013 at 4:04 am #43780DavidF
MemberEven using the simple hooks plugin and the following code doesn't load for a Premise page.
Tried front page, home page and page Id
<?php if( is_front_page () ) : ?>
hi
<?php else : ?>
<!---<div id="optin2">Join Us</div>--->
<?php endif; ?>
June 3, 2013 at 4:36 am #43782Brad Dalton
ParticipantHello David
Sorry to hear you are having problems.
Please link to your site and i'll check your home page for you.
The code I provided and tested is different to the code you embedded above.
Please copy and paste the code from the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++.
The code will not work if you modify it by adding PHP tags or by pasting it into the Simple Hooks plugin.
The only changes should be made for the page i.d
You will need to use the correct page i.d for your home page in order for the code to work.
June 3, 2013 at 5:18 am #43785DavidF
MemberHi Brad,
The child theme functions don't come into play with Premise. Premise has it's own custom function area.
Dave
June 3, 2013 at 6:05 am #43790DavidF
MemberI've contacted Premise support and explained the issue. See if they can help. Thanks for your time Brad.
June 13, 2013 at 1:53 pm #45720DavidF
MemberJust an update. Premise is a little limited for what I was trying to do. Thanks for all you help!
Dave
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.