ThemeShaper Forums » Thematic

[closed]

Child theme: using hooks vs modifying single.php

(2 posts)
  • Started 3 years ago by McSalty
  • Latest reply from Danieliser
  • This topic is not resolved
  1. I'm currently designing a heavily-customized child theme for thematic for a website with information about restaurants. I'm doing a 3 box layout, similar to this theme's home page: demo.woothemes .com/delegate/ (Remove the spaces in the URL -- the forum won't let me post the link with a space. Anyway, the layout is: slider at top, two columns below).

    There are two types of pages on my website. Each has the same layout, but different content within each section.

    1) Home page, restaurant search pages (by food type, price range, etc):
    - Full-width box at top displays introduction to website
    - Left column displays list of restaurants (posts)
    - Right column displays sidebar

    2) Restaurant listing (single post)
    - Full-width box at top displays the post
    - Left column displays restaurant's menu listing (using a custom post type)
    - Right column displays other data obtained from custom fields (hours, contact, map, etc)

    The problem is, in the two different types of pages, the loop needs to be called at different points -- in 1) we need to call the loop from the left column, while in 2) the loop must be called from the top full-width box. (Hopefully that makes sense.)

    Normally I'd just custom-code single.php, but I'm new to thematic and am trying to do things "the right way" by using filters and action hooks. Can anyone think of a smart way to set up the website to satisfy these needs? Or is it more effort than it's worth, and should I just make a new single.php in the child-theme?

    Thanks.

    Posted 3 years ago #
  2. Danieliser
    Member

    In a lot of instances you can use hooks and filters, but sometimes its best to just bite the bullet and create a custom template. If you are using custom post types then you can create a new file 'single-restaurant.php' for Custom Post Type of restaurant.

    Otherwise you can use stuff like the childtheme_override_singlepost() function. If defined replaces the singlepost function.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.