ThemeShaper Forums » Thematic

[closed]

Removing .entry-utility and (most of) .entry-meta

(14 posts)
  • Started 8 years ago by diablaroja
  • Latest reply from helgatheviking
  • This topic is resolved
  1. diablaroja
    Member

    I am using a child theme for a very basic site at http://clients.sharilynhorne.com/imarausa (my staging server).

    My question is this: On the blog pages (the main post page and the single post pages), how do I remove the .entry-utility area and (most of) .entry-meta. I do want to save the date, but I want the rest of the information gone.

    I'm sure this is somewhere in the Forums, but I can't find it. I need a basic explanation.

    Thanks!

    Posted 8 years ago #
  2. // removes author information from postmeta
    function childtheme_override_postheader_postmeta() {
    
    	$postmeta = '<div class="entry-meta">';
    	$postmeta .= thematic_postmeta_entrydate();
    	$postmeta .= thematic_postmeta_editlink();
    	$postmeta .= "</div><!-- .entry-meta -->\n";
    
    	return apply_filters('thematic_postheader_postmeta',$postmeta);
    }
    
    // modifies entrydate to remove "Published: " from Text also leaving just the date. The original line is below for reference to modify text.
    // $entrydate = '<span class="meta-prep meta-prep-entry-date">' . __('Published: ', 'thematic') . '</span>';
    function childtheme_override_postmeta_entrydate() {
    
    	$entrydate = '<span class="meta-prep meta-prep-entry-date">' . __('', 'thematic') . '</span>';
    	$entrydate .= '<span class="entry-date"><abbr class="published" title="';
    	$entrydate .= get_the_time(thematic_time_title()) . '">';
    	$entrydate .= get_the_time(thematic_time_display());
    	$entrydate .= '</abbr></span>';
    
    	return apply_filters('thematic_post_meta_entrydate', $entrydate);
    }

    I located these overrides in the thematic/library/extensions/content-extensions.php file.

    Posted 8 years ago #
  3. Now if you want to go balls to the wall with formatting that date, you will have some problems. I know some sites have dates in fancy boxes that are sort of a calendar style. If that is more the approach you were going, try this instead of the second filter above. This will add the correct span tags to do fancy styling with CSS.

    // modified date to show in spans for extremely custom modifications
    // http://us.php.net/manual/en/function.date.php (PHP formatting for dates)
    function childtheme_override_postmeta_entrydate() {
    
    	$entrydate = '<span class="meta-prep meta-prep-entry-date">' . __('', 'thematic') . '</span>';
    	$entrydate .= '<span class="entry-date"><abbr class="published" title="' . get_the_time(thematic_time_title()) . '">';
    	$entrydate .= '<span class="month">' . get_the_time('M') . '</span>';
    	$entrydate .= '<span class="day">' . get_the_time('d') . '</span>';
    	$entrydate .= '<span class="year">' . get_the_time('Y') . '</span>';
    	$entrydate .= '</abbr></span>';
    
    	return apply_filters('thematic_post_meta_entrydate', $entrydate);
    }
    Posted 8 years ago #
  4. diablaroja
    Member

    Do I create a new version of that file for the child theme?

    Posted 8 years ago #
  5. These are to be included in the functions.php in your child theme folder. The file I listed is where the original version is located.

    Posted 8 years ago #
  6. diablaroja
    Member

    thank you!

    Posted 8 years ago #
  7. diablaroja
    Member

    From this, should I be able to figure out how to get rid of the .entry-utility?

    I'm still not seeing exactly how this works. :(

    Posted 8 years ago #
  8. // goodbye entry-utility
    function childtheme_override_postfooter() {
    	// silence
    }

    Sorry, glossed over that part because it was the easy one.

    Posted 8 years ago #
  9. diablaroja
    Member

    Scott, you're a star...thanks so much!

    Posted 8 years ago #
  10. scott

    Thanks, that simple solution worked great.

    Can something similar remove the form-allowed-tags ID?

    Perhaps some way to adapt your code....

    // goodbye entry-utility
    function childtheme_override_postfooter() {
    	// silence
    }
    Posted 7 years ago #
  11. I don't have access to the Thematic files or an Text Editor, but I think to modify the comments-extension.php is a pain. If I remember it is possible, but not worth it.

    Save yourself the trouble, just use CSS.

    #form-allowed-tag { display: none; }

    Posted 7 years ago #
  12. Hello,
    I want to do something similar - remove the entry meta (postheader) from a custom template page (product pages), but not the blog posts. Basically, here's the situation:

    1. I built the site with a Thematic child theme and all went well: http://buunnicoffee.com/

    2. It is now time to add the store part of the site, and I am using WP E-Commerce.

    3. For some reason, single product pages or category pages are treated like blog posts, and postheader/entry-meta is added, i.e. a post author and the date. See: http://buunnicoffee.com/store/yirgacheffe/

    4. I can remove this with display:none on the entry-meta class, but I've heard this is a "no-no" so I am trying to do it "properly" through the functions file (filters?)

    5. I made a custom page template for the store pages called "products" (but the URL is http://buunnicoffee.com/store/ and I've tried both 'products' and 'store' in the code below...

    6. I used the following code (culled from reading various forum posts) in my functions file to remove the postheader, and I tried to specify just the 'store' or 'products' page - but it removes the author and date meta from blog posts as well, but we do want it for blog posts. So I'm having trouble figuring out how to specify that it's just for the store pages, not the blog.

    // Add a custom post header
    function childtheme_postheader() {
        global $post;
    
        if (is_page('products')) { ?>
            <h1 class="entry-title"><?php the_title(); ?></h1>
        <?php } elseif (is_404()) { ?>
            <h1 class="entry-title">Yikes! Not Found</h1>
        <?php } elseif (is_single()) { ?>
            <h1 class="entry-title"><?php the_title(); ?></h1>
    
        <?php } else { ?>
            <h2 class="entry-title"><a href="<?php the_permalink() ?>" 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') { // Hide entry meta on searches ?>
    
            <?php } ?>
        <?php }
    }
    add_filter ('thematic_postheader', 'childtheme_postheader');

    So, it does work to remove the postheader (author and date), but I can't figure out how to apply it ONLY to the custom template product pages, NOT the blog posts.

    ANY help would be greatly appreciated. I've been reading through other posts about similar topics ... but I think I am close with this bit of code. Or maybe I am completely off and need to read more. Anyway, any hints would be helpful! Thanks!

    Posted 7 years ago #
  13. Elizabeth that can be done with CSS I believe. So, use the page name and say "display: none;" in your css sheet.

    If it is the home page for example, do this:
    `
    .home .entry-meta {
    display:none;
    }

    If it is for a specific page template, use something like this:

    .page-template-template-page-blog-php .entry-meta {
    display: none;
    }

    Just change it to ".page-template-template-products-php .entry-meta" for the products template.

    Hope this helps.

    EDIT: I just read your post again because I was too lazy to read it at first lol. I have used this method before and it works, so why is it a no-no to not use the display:none? I am no expert so please correct me if i'm wrong.

    Posted 7 years ago #
  14. if you are applying it to a special page template, then why not use is_page_template()?

    is_page_template('my-special-template.php')

    also your filter function is a bit whacked... normally w/ a filter function you return a value and not echo it out the way you are. if you are trying to remove the entry-meta in certain places you could either filter the thematic_postheader_postmeta or the thematic_postheader.

    i'd offer a specific solution, but i'm sort of unclear on what your set up is... do you have a custom post type for products? if so, why aren't you using a custom post type archive instead of a regular page? either way, i don't see any post meta... which isn't surprising since you're on a page template and pages don't show post meta by default. so what is the problem exactly?

    some sample filters:

    //change the entry-meta to say BACON on category archives
    add_filter('thematic_postheader_postmeta', 'childtheme_postheader_postmeta');
    
    function childtheme_postheader_postmeta($postmeta) {
    
       if(is_category()){
    
    	    $postmeta = '<div class="entry-meta">';
    	    $postmeta .= 'BACON!';
    	    $postmeta .= "</div><!-- .entry-meta -->\n";
    
    	}
        return $postmeta;
    }
    add_filter('thematic_postheader','childtheme_postheader');
    
    function childtheme_postheader($postheader){
    
        if(is_page_template('my-special-template.php')){
              $postheader = thematic_postheader_posttitle() . ' time for more bacon!';
         }
    
        return $postheader );
    }
    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.