0

I am developing TwentyTen child theme and wish to display dynamic sidebar on front page, but something is not quite right.

I modified loop-page.php:

<div class="entry-content">
    <?php dynamic_sidebar('promotion-sidebar'); ?> //ADDED LINE
    <?php the_content(); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-content -->

At first I was invoking it inside is_front_page conditional statement but then to double check issue I decided to call it on every page. And guess what it appears on every single one except on the one I want: THE FRONT PAGE

Edit: I am using Sidebar Template for my static front page.

I just don't get it. Any help appreciated.

4
  • 1
    are you using a static front page?
    – Michael
    Commented Oct 22, 2012 at 20:54
  • yes Michael, I do. Commented Oct 22, 2012 at 20:55
  • 1
    there is no 'sidebar template' in Twenty Ten; did you create that yourself? does it contain some get_template_part('loop','page') code?
    – Michael
    Commented Oct 22, 2012 at 21:53
  • Man... I have such a nasty karma manifesting in my work sometimes. I wasted couple of hrs editing TwentyTen theme files but my Parent theme is actually TwentyEleven. And everything works just fine now upon editing that Sidebar template. Thanks for noticing this Michael, cannot express my gratitude enough. Commented Oct 22, 2012 at 23:38

1 Answer 1

2

loop-page.php is the wrong context for what you are trying to do.

If you want it to appear on the home page, then you need to edit loop.php, so in your child theme you can either create a file called,

loop.php

...which should take precedence over the loop.php found in the parent TwentyTen theme or better yet create a file called,

loop-index.php

...which will take first priority over the above. By doing this and NOT creating a loop.php we will allow the loop.php file in the parent theme to act as a fall back in case something goes wrong.

Hopefully that makes sense.

In summary, you want to create a loop-index.php file (best option).

You can simply copy the contents of what you find in loop-page.php over to this loop-index.php file to give you the basic framework for your template, then you can modify the template to your liking.

6
  • Thanks. I've tried what you suggested, copying content of loop-page into newly created loop-index file with same structure as above, with no success. Even when I add simple line as echo some text nothing show up on front page. Is this weird?? Commented Oct 22, 2012 at 21:10
  • I am using Sidebar template for my static front page. Commented Oct 22, 2012 at 21:17
  • Your sidebar template is taking priority over all else as you've set it as your static front page. Either you must edit that file or, unset the static front page option altogether and revert to using your custom loop-index.php for which you can style however you like.
    – Adam
    Commented Oct 22, 2012 at 21:19
  • Funny enough.. I cannot find the template inside twenty ten folder. I'll keep on looking. Thanks! Commented Oct 22, 2012 at 21:27
  • It might actually be a page you a referring to thats been creating in the dashboard area under Pages, not so much a template as in a page template that you create via Template name: My tempplate in the file itself. You may wish to double check that!
    – Adam
    Commented Oct 22, 2012 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.