ThemeShaper Forums » Thematic

Custom postheader but only on certain pages?

(6 posts)
  • Started 4 years ago by shelzmike
  • Latest reply from shelzmike
  • This topic is resolved
  1. shelzmike
    Member

    To start with, I am somewhat new, but learning thematic and WP for that matter very quickly (thanks to themeshaper, no doubt!). Anyhow, I got everything going smoothly so far. I have run into a bit of a snag, but I am hoping what I want to do can be accomplished.

    I am using WP (w/thematic) as a CMS for a business site. So far so good. I have hard coded some of the layout and a little of the static content; however, I will be using the actual WP posting and page editing functionality to post the core content on each page (most pages are going to be static, but the content may change, so using the built in functionality will benefit me here).

    Anyway, I ran into a problem concerning the postheader. I know exactly how it is getting there, but my problem is that I do not want the postheader to be the same as the page name on some pages. For instance: My landing page will be "Home", however, I do not want the post header to say "Home" I want it to say something like "How can we help you?" Or something to that effect.

    How can this be accomplished? What is the best way if I want to continue to rely only on a child theme (which I have created and am using). And can this be done to affect only certain pages and not others?

    I tried to research this already, and keep coming up with way to change it by apparently editing the hooks-filters.php file - that is my second question. Why can I not find this file? I have checked in themes/thematic/library/extensions/ and do not see it at all. But it has got to be somewhere, because my site is working perfectly with thematic. Thanks in advance for the help.

    Posted 4 years ago #
  2. amygail
    Member

    You don't want to edit the filters.php - you want to work with your child theme's functions.php

    This is a good start
    http://themeshaper.com/filters-wordpress-child-themes/

    Dig around Ian's site as well as the forums and you'll figure it out

    Posted 4 years ago #
  3. shelzmike
    Member

    Thanks for the reply..I was thinking that this was the way I needed to do this; however, most of the info talking about this subject seems to only work for sitewide (or themewide, that is) changes. Meaning, I am sure it is easy to remove the filter hook for the postheader for all pages, but is there a way to remove it ONLY for some pages and leave the others default? I will keep digging, but if someone could let me know if it is possible to remove the hooks just from one page then I would appreciate that.

    Could I use an if..else type function that uses the page name as a conditional variable?

    i.e. (in pseudocode)
    if page name is home
    remove postheader hook
    else, keep it in tact?

    I am somewhat new with coding language, but could easily figure out the actual code if need be - but is it possible? Thanks.

    Mike

    Posted 4 years ago #
  4. shelzmike
    Member

    Okay, while I still cannot find the hooks-filters.php file (I posted that in it's own topic), I think I figured this out and turns out (as-unfortunately-usual) I was thinking WAY to hard about this.

    Though, I am hoping that what I did is correct, since I am somewhat new to php. That being said, I will leave this listed as unresolved until I get some feedback on the code I entered.

    I realized that in my home-page.php custom page template file for this page, I already have the following:

    <?php thematic_postheader(); ?>

    Which is where I wanted to add the custom header on certain pages.

    I realize that I could simply remove this whole block and just add the HTML - that is if I only use home-page.php as the template for "only" the home page, which I may and then again, I may not.

    Since I may not I replaced the above code with:

    if (is_page(3)) {
         echo "<h1 class='entry-title'>What can we do for you?</h1>";
    }
    else
         thematic_postheader();
    ?>;

    Is this accurate and the correct way to handle this?

    Mike

    Posted 4 years ago #
  5. amygail
    Member

    I really think the answer lies here
    http://themeshaper.com/action-hooks-wordpress-child-themes/

    If you scroll down - you'll see "Filtering Theme Functions" - Ian takes you through filtering your post header.

    You won't find 'hooks-filters.php' as it doesn't exist, but you can go here
    http://themeshaper.com/thematic/guide/

    for a list of hooks and filters - you can also look through your 'content-extentions.php' and sidebar-extentions.php' you'll see that it's pretty well commented.
    I hope that helps.

    Posted 4 years ago #
  6. shelzmike
    Member

    Thanks again my-guru-for-the-day amy :) I read that info and it makes sense to me (for the most part - the parts that do not are just due to my lack of being proficient with php, but I am learning!); however, this information led me to do it the way mentioned above because I did not really want to make this a global change. And this way works just as well. I just put it in my home-page.php template for my home page.

    Mike

    Posted 4 years ago #

RSS feed for this topic

Reply

You must log in to post.