ThemeShaper Forums » Thematic

Edit Post Meta Data

(7 posts)
  • Started 5 years ago by TribeLeader
  • Latest reply from adam8885
  • This topic is resolved

Tags:

  1. TribeLeader
    Member

    I've read several questions on editing post meta data but couldn't figure out what exactly I need.

    I want to edit the post meta data so that something like "Posted [DATE] in [CATEGORY]" appears underneath the entry title. I'm new to child themes; in the past, I would have edited the original theme. How can I accomplish this in Thematic?

    Thanks!

    Posted 5 years ago #
  2. All the stuff you need to modify is called by the thematic_postheader() function. After some searching i found that that function resides in thematic/libary/extensions/hooks-filters.php.
    Theoretically you have to filter that function in order to display what you want. The first place you´d go is that page that explains how to work with actions and filters.

    Posted 5 years ago #
  3. Update:
    Add this to your child theme functions.php file:

    function custom_postmeta($postmeta){
     $postmeta = '<div class="entry-meta">';
        $postmeta .= 'Posted on ';
        $postmeta .= '<span class="entry-date"><abbr class="published" title="';
        $postmeta .= get_the_time(thematic_time_title()) . '">';
        $postmeta .= get_the_time(thematic_time_display());
        $postmeta .= '</abbr></span>';
        $postmeta .= " in " . get_the_category_list(', ');
        // Display edit link
        if (current_user_can('edit_posts')) {
            $postmeta .= ' <span class="meta-sep">|</span> ' . $posteditlink;
        }
        $postmeta .= "</div><!-- .entry-meta -->\n";
    return $postmeta;
    }
    add_filter('thematic_postheader_postmeta', 'custom_postmeta');
    Posted 5 years ago #
  4. TribeLeader
    Member

    Perfect.

    I also added ...

    .entry-meta .meta-sep {
    display: none;
    }

    to remove the "|" (pipe) at the end of the line (assuming that's the best way to do that. I saw that another thread, http://forums.themeshaper.com/topic/edit-post-meta-data#post-1297.

    I'm comfortable with (X)HTML and CSS, but I've just getting into PHP so I appreciate the help!

    Thanks!

    Posted 5 years ago #
  5. Hi,
    Note that the pipe only shows when there is an user with edit privileges logged in. To the ordinary visitor it will not show. If you wanna get rid of it at all, remove that part of the code maintaining the rest untouched.

    // Display edit link
        if (current_user_can('edit_posts')) {
            $postmeta .= ' <span class="meta-sep">|</span> ' . $posteditlink;
        }

    Thus you will save your style sheet some bytes.

    Posted 5 years ago #
  6. TribeLeader
    Member

    Ah, thanks.

    Posted 5 years ago #
  7. adam8885
    Member

    solved

    Posted 5 years ago #

RSS feed for this topic

Reply

You must log in to post.