GetSimple Support Forum
same header image for parent and child pages - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Scripts & Components (http://get-simple.info/forums/forumdisplay.php?fid=11)
+--- Thread: same header image for parent and child pages (/showthread.php?tid=3006)



same header image for parent and child pages - andyash - 2012-03-29

How can I show a parent page header image in child pages as well? What code do I use?


same header image for parent and child pages - lucamusolesi - 2012-03-29

Can you explain more about your problem?

If the header image has to be in every page just add it in the template, if not you can add it in the editor..


same header image for parent and child pages - andyash - 2012-03-29

lucamusolesi Wrote:Can you explain more about your problem?

If the header image has to be in every page just add it in the template, if not you can add it in the editor..

Currentyl I am using this code for dynamic header images for individual pages.
Code:
<div id="headerpic"><img src="<?php get_site_url(); ?>data/uploads/headerpics/<?php get_page_slug(); ?>.jpg"></div>

But I want the child pages (and maybe third level pages as well) to have the same image as the parent page. How do I get that?


same header image for parent and child pages - mvlcek - 2012-03-29

andyash Wrote:Currentyl I am using this code for dynamic header images for individual pages.
Code:
<div id="headerpic"><img src="<?php get_site_url(); ?>data/uploads/headerpics/<?php get_page_slug(); ?>.jpg"></div>

But I want the child pages (and maybe third level pages as well) to have the same image as the parent page. How do I get that?

For second level pages change your code to:
Code:
<div id="headerpic">
  <img src="<?php get_site_url(); ?>data/uploads/headerpics/<?php !get_parent(false) ? get_page_slug() : get_parent(); ?>.jpg">
</div>

For all levels with the I18N plugin:
Code:
<div id="headerpic">
  <?php $bc = return_i18n_breadcrumbs(return_page_slug()); ?>
  <img src="<?php get_site_url(); ?>data/uploads/headerpics/<?php echo $bc[0]['url']; ?>.jpg">
</div>



same header image for parent and child pages - andyash - 2012-03-29

This works great. Thanks.