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 having two kinds of categories one is events and another is no_category. Posts of Event Calendar are placed under events category and rest are in no_category.

As you know what is the default layout of all the posts. At the top Title of the post then below it reply then below it's content etc...

Now I want to change the format for "event" category posts as in Excel format:

Title | Created Date | Created By | Details | Edit

How can I do this?

share|improve this question
add comment

1 Answer

You can use the Conditional Tag in_category() within the loop:

if( in_category( 'events' ) ):
    // output stuff for events category post
else:
    // not in events category
endif;

Another option for single posts is to load a different template with a filter based on the category:

function wpa8176_category_single_template( $template = '' ){
    $categories = get_the_category();
    foreach( $categories as $cat ):
        if( 'events' == $cat->name ):
            $template = locate_template( array( "events-single.php", $template ), false );
        endif;
    endforeach;
    return $template;
}
add_filter( 'single_template', 'wpa8176_category_single_template' );
share|improve this answer
    
Kindly tell me in which file I have to do this (in_category). –  Bhuvnesh Gupta Jan 16 '13 at 6:04
    
In whatever template file is outputting your posts. See the Template Hierarchy to figure out which one. –  Milo Jan 16 '13 at 6:15
    
Actually events posts are coming from any of the plugin php file so I am not able from where to do theses changes –  Bhuvnesh Gupta Jan 16 '13 at 6:18
    
you'll have to ask the plugin developer then, or perhaps someone else here is familiar with the plugin and can answer your question. –  Milo Jan 16 '13 at 6:22
    
Ok. Thanks Mr. Milo I will try it myself if I need more help then Please HELP me! –  Bhuvnesh Gupta Jan 16 '13 at 6:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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