ThemeShaper Forums » Thematic


Don't understand how I can edit code using filters/actions

(5 posts)
  • Started 13 years ago by mastrom
  • Latest reply from Sad
  • This topic is resolved
  1. mastrom

    Hey, I am kinda new here. Been looking for a solution for my problem but I cant come up with one. I am fooling around with a childtheme, I know how easy and flexible it is. I am kinda getting the hang of this. But having problem finding how I can modify codes from the thematic functions using actions or filters in my childtheme.

    I am no expert on php but I know a fair amount to get around in Wordpress. I understand the concept with hooks, thats no problem. But I can't seem to find any where on the internet an explanation how I can edit the thematic function code throughh my childtheme. I have only succeeded in putting in more code, like adding divs or other tags around the real code coming from the thematic functions.

    I copy the functions from the extensions library in the thematics folder. Lets say I wanted this function to replace the one in the thematics folder. What modifications do I have to make?

    // The Single Post
    function childpage_single_post() { ?>
    <div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class(); ?>">
    <?php thematic_postheader(); ?>
    <div class="entry-content">
    <?php thematic_content(); ?>

    <?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?>
    <?php thematic_postfooter(); ?>
    </div><!-- .post -->
    add_filter('thematic_singlepost', 'childpage_single_post');

    Now I all see is double posts when I view a singlepost. I wanted it to replace the old function. I am going nuts over this. Am I hooking the wrong functions? Have I misunderstood the whole concept? :S Help would be appreciated!

    Posted 13 years ago #
  2. mastrom

    Never mind, I reread one of the old tutorials I read. Tried it and mixed it a little. Now I can manage to change functions in the thematics extension library.

    So it is solved :D

    Posted 13 years ago #
  3. Can you please share your solution

    Posted 13 years ago #
  4. Sad-

    Check out these two tutorials:
    Action Hooks
    Filter Hooks
    and also study the examples in the hooks and filters section of the Thematic Guide


    Posted 13 years ago #
  5. Thanks, Gene, so much.

    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.