Hello i am looking to edit the thematic loops to be custom to my likings where do I go to edit this?
- or should I add the loops to the functions.php to make it easier then editing core files.
Hello i am looking to edit the thematic loops to be custom to my likings where do I go to edit this?
- or should I add the loops to the functions.php to make it easier then editing core files.
remember, all edits for your child theme go in your theme's functions.php
remove old loops from their hooks first. then write the function for your new loop and then add that new function on to the hook you vacated.
//remove default loop
function remove_single_post() {
remove_action('thematic_singlepost', 'thematic_single_post');
}
add_action('init', 'remove_single_post');
//create new loop
function child_single_post() {
//do stuff
}
add_action('thematic_singlepost', 'child_single_post');
// End of single
or if you are using the latest stable dev release of thematic you can simply define your new loop as
function childtheme_override_single_post () {
//do stuff
}
without having to remove and add functions, since the override will now happen automagically.
Thank you how about the Archive page template? how do I remove / add function for that?
For some reason this isn't working but the rest of my loops are
<?php
function remove_singlepost() {
remove_action('thematic_singlepost', 'thematic_single_post');
}
add_action('init', 'remove_singlepost');
function child_single_post() {
while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2 class="pagetitle">" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></h2>
<small>Posted by <?php the_author_posts_link(); ?> on <?php the_time('F jS, Y') ?> </small>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<!-- Share Meta Below -->
<div class="entry-meta-below">
<span class="share-via">Share this post:</span>
<span class="twitter-link">" title="TwitThis">Twitter ,</span>
<span class="facebook-link">/" title="Facebook">Facebook ,</span>
<span class="digg-link">" title="Digg">Digg ,</span>
<span class="delicious-link">/" title="del.icio.us">Delicious ,</span>
<span class="comments-link"><?php comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)'); ?></span>
<span></span>
</div>
<?php if (function_exists('related_posts')){ ?>
<?php related_posts();?>
<?php }?>
<div style="clear: both;"></div>
</div>
<?php endwhile;
}
add_action('thematic_singlepost', 'child_single_post');
?>
Not working unfortunately I can't get it to work.
you can post code by surrounding it with backticks
your code didn't work b/c you dont need a while loop for the single post and you have multiple, improperly closed brackets. try:
function remove_singlepost() {
remove_action('thematic_singlepost', 'thematic_single_post');
}
add_action('init', 'remove_singlepost');
function child_single_post() {
?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2 class="pagetitle" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></h2>
<small>Posted by <?php the_author_posts_link(); ?> on <?php the_time('F jS, Y') ?> </small>
<div class="entry">
<?php the_content('Read the rest of this entry ยป'); ?>
</div>
<!-- Share Meta Below -->
<div class="entry-meta-below">
<span class="share-via">Share this post:</span>
<span class="twitter-link" title="TwitThis">Twitter ,</span>
<span class="facebook-link" title="Facebook">Facebook ,</span>
<span class="digg-link" title="Digg">Digg ,</span>
<span class="delicious-link"" title="del.icio.us">Delicious ,</span>
<span class="comments-link"><?php comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)'); ?></span>
<span></span>
</div>
<?php if (function_exists('related_posts')){ ?>
<?php related_posts();?>
<?php }?>
<div style="clear: both;"></div>
</div>
<?php }
add_action('thematic_singlepost', 'child_single_post');
the best place to go when trying to write loops is the content extensions file in the thematic library folder. you can copy the existing loop (which btw is also where you will find info on the archives, tags, author, category, etc loop) into your functions file and make the modifications from that working base.
nice man ! worked
How bout the archive page template how should I add a function for that?
And if anyone cares to see what I have been working on.. this theme is running on Thematic
well i don't know what you want to do to the archive template, but the process is essentially the same. in the extensions folder of thematic you will see the content-extensions.php file. that is where the thematic_archive_loop() function is defined. you can copy it from there, mod it, then use your version of the function in exactly the same way as you did for the single loop.
You must log in to post.