Lisa on "[Theme: Sela] Displaying (or not)"

ساخت وبلاگ

Hi ariane98

Yes, there is a way to make the front page different than the rest of the pages. That often happens in websites and WordPress allows for it.

First, if you haven't done so yet, you should create a child theme for your site.
If you edit the theme files (header.php) and the theme is updated, it will over-write your hard work. Child themes avoid that.

See: https://codex.wordpress.org/Child_Themes

Second, copy your new 'header.php' file into your child theme folder.
That makes your changes live without being over-written during an update.
(You'll sleep better at night. ;-) )

Third, add code to your header.php file in the child theme so the header in the front page is different than the rest of the pages.

The key is: is_front_page()
Note: This only works if you've set a 'static page' as your 'Front Page' in Settings.
Dashboard->Settings->Front page displays

See: https://codex.wordpress.org/Function_Reference/is_front_page

To add the code, set up an 'if' statement in displaying the header.

Something like:

<?php if(is_front_page()){ ?> <div class="site-branding"> <?php sela_the_site_logo(); ?> <h1 class="site-title"> ... </div><!-- .site-branding -->
<?php } ?>

If you wanted to have a different kind of header, you can expand the 'if' statement to display something else if the page isn't the front page.

Your code will look something like:

<?php if(is_front_page()){ ?> <div class="site-branding"> ..... </div><!-- .site-branding -->
<?php }else{ ?>
<div class="site-branding" id="inside_page"> ..... </div><!-- .site-branding -->
<?php } // end if front page ?>

Note: If it's not the front page, the id 'inside_page' is added.
This means you still have the same header on the inside pages, but you can format them differently through CSS. The id will make writing the CSS easier.

Hope this helps!

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : lisa themes,lisa theme silent hill,lisa's theme from rear window,lisa theme piano,lisa's theme silent hill mp3,lisa theme not tomorrow,lisa's theme big sir,lisa's theme guitar,lisa's theme simpsons, نویسنده : استخدام کار wpss بازدید : 384 تاريخ : چهارشنبه 20 مرداد 1395 ساعت: 1:23