Forums

How Do I Edit The Category Page (10 posts)

  1. Matt Jo
    Member
    Posted 1 year ago #

    For example, this page http://wegotthiscovered.com/category/movies/

    How would I edit the template file for that, I don't have any category.php file so where would I go to edit it

  2. MAS
    Member
    Posted 1 year ago #

    edit your single.php file

  3. Matt Jo
    Member
    Posted 1 year ago #

    thanks!

    also if you go to my site wegotthiscovered.com you'll notice if you click on a post it only shows the title, not the category or tags, how do I get it to show the category/tags?

    Thanks

  4. Matt Jo
    Member
    Posted 1 year ago #

    oh btw that didn't work, single.php is for posts, not the categories page

  5. alchymyth
    The Sweeper
    Posted 1 year ago #

    if your theme does not have a category.php, make a copy of archive.php (if archive.php exists, otherwise from index.php) and save it as category.php - then edit it.

    http://codex.wordpress.org/Template_Hierarchy

    to show categories in single posts, you can use:
    <?php the_category(', ') ?>
    http://codex.wordpress.org/Function_Reference/the_category

    and for tags:
    <?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
    http://codex.wordpress.org/Function_Reference/the_tags

    in single.php

  6. Matt Jo
    Member
    Posted 1 year ago #

    ok thanks

    also how do I get my site to show the "read more" button on the category pg and the search result pg

  7. imgr8
    Member
    Posted 1 year ago #

    I think you can look in the default theme provided by wordpress and copy-paste code from there =)

  8. Matt Jo
    Member
    Posted 1 year ago #

    i cant figure out where those tag and category codes go, can someone help me, I'll email you my files if you like

    let me know

    thanks

  9. Matt Jo
    Member
    Posted 1 year ago #

    anyone?

  10. imgr8
    Member
    Posted 1 year ago #

    Well I looked in the default WP3 theme and this is the code you can use. In the single.php , use this code to show the category and tags wherever you like :

    <?php mytheme_posted_in(); ?>

    For the above to work, add this in your functions.php file :

    if ( ! function_exists( 'mytheme_posted_in' ) ) :
    
    function mytheme_posted_in() {
    	// Retrieves tag list of current post, separated by commas.
    	$tag_list = get_the_tag_list( '', ', ' );
    	if ( $tag_list ) {
    		$posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'mytheme' );
    	} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
    		$posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'mytheme' );
    	} else {
    		$posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'mytheme' );
    	}
    	// Prints the string, replacing the placeholders.
    	printf(
    		$posted_in,
    		get_the_category_list( ', ' ),
    		$tag_list,
    		get_permalink(),
    		the_title_attribute( 'echo=0' )
    	);
    }
    endif;

    For the excerpt for search and archives, use <?php the_excerpt(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.