ThemeShaper Forums » Thematic

remove thematic_postheader only on pages and posts

(7 posts)
  • Started 10 years ago by Scott
  • Latest reply from Scott
  • This topic is not resolved
  1. i am new to thematic, but have made a nice child theme.

    The challenge i have is to remove thematic_postheader only on pages and posts but leave it on the archives

    i tried using is_page in functions.php without success. thanks scott

    Posted 10 years ago #
  2. you're using the right function and is_page is what should be used to distinguish pages from single posts or index.php. Would be helpful if you would post a snippet of what you're trying to accomplish that is not working.

    Posted 10 years ago #
  3. Thanks Sharninder, i am using this code, if is_page then empty thematic_postheader. apparently is_page wont work from functions.php because it is not running in the page?

    if (is_page) {
    	function gentleplumbing_thematic_postheader() {
    		// Abscence makes the heart grow fonder
    	}
    add_filter('thematic_postheader','gentleplumbing_thematic_postheader');
    }
    Posted 10 years ago #
  4. In your snippet, all you've done is added a comment to the existing php, which does nothing to the output. Also, is_page() is a function, so to call it you need the '()' at the end.

    Try using this:

    if (is_page()) {
    	function gentleplumbing_thematic_postheader() {
    		return false; //switches it off
    	}
    
    add_filter('thematic_postheader','gentleplumbing_thematic_postheader');
    }

    This code doesn't just add a blank comment to the existing post-header code, but instead 'switches it off'.

    Posted 10 years ago #
  5. Thanks Juanojeda, this had the same effect as my original code, is_page returns true for all pages so thematic_postheader is removed from all pages and archives, where i only want to remove it from a few. any suggestions welcome

    Posted 10 years ago #
  6. Hi,

    first of all I recommend that you read the article 'Conditional Tags' on wordpress.org.

    is_page() will recognize a PAGE! And a page is a page is a page! It's not a post!

    Second if you're using a filter you should return something if the chosen condition is true and you should return something else if the chosen condition is wrong. If you need to return the original content I strictly recommend to get the original content into your filter function:

    function childtheme_whatever($content) {
        if (is_whatever()) {
            return '';
        } else {
            return $content;
        }
    }
    add_filter('thematic_AnyFilter', 'childtheme_whatever');

    If you don't do that you'll see this strange behavior :-)

    Chris

    Posted 10 years ago #
  7. thanks for your help chris i have it working now.

    Posted 10 years ago #

RSS feed for this topic

Reply

You must log in to post.