ThemeShaper Forums » Thematic


Custom home page with a single post?

(2 posts)
  • Started 9 years ago by adred
  • Latest reply from Danieliser
  • This topic is not resolved
  1. adred

    Hi all!
    First time here. I'd to ask how do I go about it? I copied the page template from the parent theme and renamed to home.php and set it as the template for the home page. Then I added a hook to thematic_above_indexloop() in functions.php but it doesn't seem to work. Here's my action hook:

    function show_single_post(){
    $i=0; // Initialize to Zero;
    if (have_posts()) :
    while (have_posts()) : the_post();
    if ($i==0) {$recentpostid = $post->ID; $i=$i+1;}
    //get only the latest post
    $posts = query_posts( 'p='.$recentpostid."'");
    add_action('thematic_above_indexloop', 'show_single_post');

    However, if I embed that code snippet into the home.php directly, it works. There must something wrong with my action hook? I am relatively new to using hooks pls enlighten me.

    Posted 9 years ago #
  2. Danieliser

    i believe you are missing the priority of the add_action('hook', 'function', 'priority')

    add_action('thematic_above_indexloop', 'show_single_post', 5);

    not sure what the priority should be but you can adjust it and check it in a browser.

    Also there is a difference between home and index. If you coppied the page.php contents then there wont be a thematic_above_indexloop. On the page.php there are three hooks you could use, thematic_abovecontainer, thematic_abovecontent, thematic_abovepost - the last being most likely the one you need.

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.