ThemeShaper Forums » Thematic

[closed]

Thematic Feature Site: Filter out leader on all but "home"?

(11 posts)
  • Started 4 years ago by theandyreport
  • Latest reply from seedling
  • This topic is not resolved
  1. theandyreport
    Member

    Hello,

    I just bought - and am loving - the Feature Site child theme! I love the random feature item on the homepage, but I don't have any use for the leader div other than on this front page. How could I filter out/collapse/hide this leader div everywhere except for the "Home" page?

    So, the front page of (vicfirth.com/exchange) is exactly what I'm looking for, but I would like the content pages/categories/posts to all look like (vicfirth.com/newswire).

    Thanks for a great product and great support! Learning a lot and loving it.
    -Andy

    Posted 4 years ago #
  2. Hi Andy,

    you need to modify the functions.php a bit. Search for:

    function childtheme_pageleader() { ?>
        <?php global $id, $post, $authordata; ?>

    change this to:

    function childtheme_pageleader() { ?>
        <?php global $id, $post, $authordata;
    	if (is_page_template('front-page.php')) {?>

    Search for:

    <?php }
    add_action ('thematic_belowheader','childtheme_pageleader',2);

    change this to:

    <?php } }
    add_action ('thematic_belowheader','childtheme_pageleader',2);

    That's it .. in theory you could delete a lot of the childtheme_pageleader function, but this is the easiest way to adjust the display to your needs.

    Chris

    Posted 4 years ago #
  3. theandyreport
    Member

    Wow. Ok. Yes! I had tried to pull the items i did not need out of the functions file, but this is much easier. So essentially, you've just wrapped all the stuff we're never going to use in an if that's only true if we are on the front page template? And since that stuff will never get used on the front page, it just sits there, harmless?

    Cool. Thanks so much, Chris.
    -Andy

    Posted 4 years ago #
  4. That's right .. the whole function will only start to do it's work if the front page template is in use. And in this case it'll only run through the random items stuff without touching the rest.

    The rest of the functionality is still there .. so .. if you want to have the leader part on a certain page / post you could easily extend if (is_page_template('front-page.php')) with additional conditional tags.

    Chris

    Posted 4 years ago #
  5. curobs
    Member

    Hi-I wish to do the same for the powerblog theme, use the leader aside only on the home page. I realize now that the function.php mentioned here is for the thematic theme (which might explain why I couldn't find the function childtheme_pageleader() in the powerblog theme files). Is there a reason why this same function won't work for powerblog theme? The leader aspect sounds very similar.

    Posted 4 years ago #
  6. ditzah
    Member

    Help!

    I'm using something similar on my blog, but I get a php error:
    Parse error: syntax error, unexpected $end in /../functions.php on line 140

    What am I doing wrong? It used to work, but I lost the file and tried to recover from remains and backups and memory...

    Here's the code:

    <?php
    function childtheme_date() { ?>
    <div class="aboveheader">
    <div class="aboveheader_right">
    The time in Romania is
    <?php
    date_default_timezone_set('Europe/Bucharest');
    echo date ('h A'); ?>
    �| Today is
    <?php
    echo date('l, F jS, Y'); ?>
    </div>
    
    <!--aici bag meniul-->
    <div class="aboveheader_left">
    
    <ul>
    <?php wp_list_pages('title_li=&link_after= | '); ?>
    </ul>
    </div>
    </div>
    <?php }
    add_action('thematic_header','childtheme_date',0);
    #Add a drop down category menu
    function childtheme_category_menu() { ?>
            <div id="category-menu" class="menu">
                <ul id="category-nav" class="sf-menu">
                    <?php wp_list_categories('exclude=1&title_li='); ?>
    
            </div>
    <?php }
    add_action('wp_page_menu','childtheme_category_menu');
    
    #language
    function journal_language () { ?>
    <div id="lang">
    <?php qtrans_generateLanguageSelectCode(image); ?>
    </div>
    <?php }
    add_action('thematic_header','journal_language',2);
    
    #banner
    function banner() {?>
    <div id="banner">
    	<a href="..">
    	<img src="..png" alt=".." /></a>
    	<hr>
    </div>
    <?php }
    
    add_action('thematic_aboveindextop','banner');
    
    // Add a search form to the header
    function childtheme_searchform() {
        get_search_form();
    }
    add_action('thematic_header','childtheme_searchform',7);
    
    // Customize the search form
    function childtheme_search_form($form) {
        $form = '<form method="get" id="searchform" action="' . get_option('home') . '/" >
                <label class="hidden" for="s">' . __('Search:') . '</label>
                <div>';
        if (is_search()) {
            $form .='<input type="text" value="' . attribute_escape(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />';
        } else {
            $form .='<input type="text" value="To search, type and hit enter" name="s" id="s"  onfocus="if(this.value==this.defaultValue)this.value=\'\';" onblur="if(this.value==\'\')this.value=this.defaultValue;"/>';
        }
        $form .= '<input type="submit" id="searchsubmit" value="'.attribute_escape(__('Search')).'" />
                </div>
                </form>';
        return $form;
    }
    add_filter('get_search_form', 'childtheme_search_form');
    
    // Add a custom page leader
    // Basically adding the title to a fluid block just after the header
    // including a random feature item on the home page
    function childtheme_pageleader() { ?>
        <?php global $id, $post, $authordata;
    	if (is_single()) {?>
        <div id="leader">
            <div id="leader-container">
    
    <?php if (is_page() && !is_front_page()) { ?>
                <h1 class="entry-title"><?php the_title(); ?></h1>
    <?php } elseif (is_404()) { ?>
                <h1 class="entry-title">Not Found</h1>
    <?php } elseif (is_page_template('front-page.php') ) {
        /*
        Highlight your most important projects with a series of files (2 to start with) named feature-front-x.php.
        Where x is a number. Then, these files are randomly included on the front page. It’s pretty simple stuff.
    
        The important bit is the mt_rand(1,2). Right now it’s randomly including 1 of 2 files.
        If you had 15 files you’d need to have mt_rand(1,15) in there.
        */
        $rand = mt_rand(1, 2);
        include "includes/feature-front-$rand.php";
    } elseif (is_home()) { ?>
                <h1 class="entry-title"><?php bloginfo('name') ?> Blog</h1>
    <?php } elseif (is_archive()) { ?>
                <h2 class="entry-title"><?php bloginfo('name') ?> Blog</h2>
    <?php } elseif (is_search()) {?>
                <h2 class="entry-title"><?php _e('Search Results for:', 'thematic') ?> <span id="search-terms"><?php echo wp_specialchars(stripslashes($_GET['s']), true); ?></span></h2>
    <?php } elseif (is_single()) { ?>
                <h1 class="entry-title"><?php the_title(); ?></h1>
                <div class="entry-meta">
                	<span class="author vcard"><?php _e('By ', 'thematic') ?><a>ID, $authordata->user_nicename); ?>" title="<?php __('View all posts by ', 'thematic') . the_author(); ?>"><?php the_author() ?></a></span>
                	<span class="meta-sep"> | </span>
                	<span class="entry-date"><abbr class="published" title="<?php get_the_time('Y-m-d\TH:i:sO'); ?>"><?php the_time('F jS, Y') ?></abbr></span>
                </div><!-- .entry-meta -->
    <?php } ?>
    
            </div><!-- #leader-container -->
        </div><!-- #leader -->
    <?php } }
    add_action ('thematic_belowheader','childtheme_pageleader',2);
    
    // Add a custom post header
    // A lot of this involves removing the title from where I no longer need it
    function childtheme_postheader() {
        global $post; 
    
        if (is_page() || is_404() || is_single()) {
            // Absence makes the heart grow fonder
        } else { ?>
    		<h2 class="entry-title"><a>" title="<?php printf(__('Permalink to %s', 'thematic'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h2>
    		<?php if ($post->post_type == 'post') { ?>
    		<div class="entry-meta">
              	<span class="author vcard"><?php _e('By ', 'thematic') ?><a>ID, $authordata->user_nicename); ?>" title="<?php __('View all posts by ', 'thematic') . the_author(); ?>"><?php the_author() ?></a></span>
    			<span class="meta-sep"> | </span>
    			<span class="entry-date"><abbr class="published" title="<?php get_the_time('Y-m-d\TH:i:sO'); ?>"><?php the_time('F jS, Y') ?></abbr></span>
    		</div><!-- .entry-meta -->
    		<?php } ?>
        <?php }
    }
    add_filter ('thematic_postheader', 'childtheme_postheader');
    
    ?>
    Posted 4 years ago #
  7. I dindnt test this but only pasted this into a text editor to scan it with syntax hightlighting:

    on line 133 is see a missing <?php

    look for:

    <a>ID,$authordata->user_nicename); ?>

    Hope That helps- Gene

    Posted 4 years ago #
  8. Hi, I tried the method mentioned in Chris' first response, but it caused the entire code to fail and I get a syntax error as well.

    As the site is on localhost, I can't post a link.

    Posted 3 years ago #
  9. my bad - I pasted it wrong!

    Posted 3 years ago #
  10. Chris or EM HR — I'm trying to accomplish something that is pretty much the opposite of what Andy was trying to do — I want the "page-bottom" content from Thematic to be brought into my Feature site front page, but lack the programming expertise to figure out what's going wrong.

    Can you take a look at this thread and lend me a hand?

    http://forums.themeshaper.com/topic/thematic-feature-site-page-bottom-issue-on-front-page

    Posted 3 years ago #
  11. seedling
    Member

    The code Chris offered worked perfectly, thank you! However, not I'm not sure how to put the page headers back onto the content box? Do you know where and what code to use to add that into main?

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.