Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i am newbie with php , i need help to create function to add it in thematic theme content area from this code ?

$term_slug = get_query_var( 'term' );
$taxonomyName = get_query_var( 'taxonomy' );
$current_term = get_term_by( 'slug', $term_slug, $taxonomyName );
$args = array( 'child_of' => $current_term->term_id, 'hide_empty'=>false);
$terms = get_terms( 'tagportifolio', $args);
$assoc = taxonomy_image_plugin_get_associations();

if (!empty($terms)):
 <?php foreach( $terms as $child ): ?>
<?php  if(array_key_exists( $child->term_taxonomy_id, $assoc )){echo wp_get_attachment_image( $assoc[$child->term_taxonomy_id], array(), false, 'thumbnail');
                                                        } 
                                                    ?>
<a href="<?php echo get_term_link( $child->name, $taxonomyName );?>"><?php echo $child->name; ?></a ><br/>
<?php endforeach; ?>
<?php else: ?>

any help please ?

share|improve this question

closed as not a real question by Michael, brasofilo, Chris_O, Wyck, Brian Fegter Aug 30 '12 at 3:18

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
what are you trying to do? And what is not working? Try to add more details. –  Sisir Jul 31 '12 at 8:36
    
just want to wrap the above code in function , second make this function work on category loop in thematic child theme –  Rasha Nour Eldin Aug 1 '12 at 8:49

1 Answer 1

up vote 3 down vote accepted

Thanks for help i found the solution

<?php
/**
 * Page Template
 *
 * …
 * 
 * @package Thematic
 * @subpackage Templates
 */

    // calling the header.php
    get_header();

    // action hook for placing content above #container
    thematic_abovecontainer();
?>

        <div id="container">

                <?php
                // action hook for placing content above #content
                    thematic_abovecontent();

                // filter for manipulating the element that wraps the content 
                    echo apply_filters( 'thematic_open_id_content', '<div id="content">' . "\n" );

                    // calling the widget area 'page-top'
                get_sidebar('page-top');
                    $term_slug = get_query_var( 'term' );
                    $taxonomyName = get_query_var( 'taxonomy' );
                    $current_term = get_term_by( 'slug', $term_slug, $taxonomyName );
                    $args = array( 'child_of' => $current_term->term_id, 'hide_empty'=>false);
                    $terms = get_terms( 'tagportifolio', $args);
                    $assoc = taxonomy_image_plugin_get_associations();

                    if (!empty($terms)):
                ?>
                    <?php foreach( $terms as $child ): ?>
                        <?php thematic_abovepost(); ?>
                        <div id="cat-<?php echo $child->term_id; ?>">
                        <?php
                            if(array_key_exists( $child->term_taxonomy_id, $assoc )){
                                 echo wp_get_attachment_image( $assoc[$child->term_taxonomy_id], array(), false, 'thumbnail');
                             }
                        ?>

                        <h1 class="entry-title"><a href="<?php echo get_term_link( $child->name, $taxonomyName );?>">
                        <?php echo $child->name; ?></a ></h1><br/>
                        </div>
                        <?php thematic_belowpost();?>

                        <?php endforeach; ?>

                        <?php 
                            else: 
                            // start the loop
                            while ( have_posts() ) : the_post();
                            // action hook for placing content above #post
                                thematic_abovepost();
                        ?>

                        <?php
                                echo '<div id="post-' . get_the_ID() . '" ';
                                // Checking for defined constant to enable Thematic's post classes
                                if ( ! ( THEMATIC_COMPATIBLE_POST_CLASS ) ) {
                                        post_class();
                                        echo '>';
                                } else {
                                        echo 'class="';
                                        thematic_post_class();
                                        echo '">';
                                }
                                thematic_postheader();
                        ?>

                                <div class="entry-content">

                                    <?php the_content(); ?>

                                </div><!-- .entry-content -->

                        </div><!-- #post -->

            <?php
                // action hook for inserting content below #post
                thematic_belowpost();

                // action hook for calling the comments_template
                //thematic_comments_template();

                // end loop
                endwhile;
                        endif;

                // calling the widget area 'page-bottom'
                get_sidebar( 'page-bottom' );
            ?>

            </div><!-- #content -->

            <?php 
                // action hook for placing content below #content
                thematic_belowcontent(); 
            ?> 

        </div><!-- #container -->

<?php 
    // action hook for placing content below #container
    thematic_belowcontainer();

    // calling the standard sidebar 
    /*thematic_sidebar();*/

    // calling footer.php
    get_footer();
?>
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.