ThemeShaper Forums » Thematic

[closed]

Trying to add php include and html tags to same hook.

(6 posts)
  • Started 3 years ago by laughhearty
  • Latest reply from laughhearty
  • This topic is not resolved
  1. Hi,
    I've just started digging into using hooks and filter and it's been quite the rocky road.
    I'm trying to add a include to just the homepage of my theme. I need the hook function to contain the include as well as some html.
    Right now the include is showing up on every page and when I try to make it just show up on homepage I get the frustrating blank screen.

    Below is my code:

    function gallery_include() { ?>
    <?php include (STYLESHEETPATH . "/gallery.php"); ?>
    <?php }
    add_action('thematic_abovecontainer','gallery_include');

    What do I need to add?

    Thanks

    Posted 3 years ago #
  2. you need conditional logic

    http://codex.wordpress.org/Conditional_Tags

    Posted 3 years ago #
  3. okay,
    I've tried this code:

    function gallery_include() {
    	if(is_front_page()) {
     echo '<?php include (STYLESHEETPATH . "/gallery.php") ?>';
      }
    }
    add_action('thematic_abovecontainer','gallery_include', 1);

    And my slideshow completely disappears.

    Posted 3 years ago #
  4. if the first code you posted worked.. why did you change other things besides the conditionals?

    no idea if this works but, what about:

    function gallery_include() {
    if(is_front_pageI()){
       include (STYLESHEETPATH . "/gallery.php");
     }
    }
    add_action('thematic_abovecontainer','gallery_include');
    Posted 3 years ago #
  5. there's a mistake in your code helgatheviking ;)


    function gallery_include() {
    if(is_front_page()){
    include (STYLESHEETPATH . "/gallery.php");
    }
    }
    add_action('thematic_abovecontainer','gallery_include');

    Posted 3 years ago #
  6. Doh!

    Thank you, Joperron!

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.