Viewing 9 replies - 1 through 9 (of 9 total)
  • edit your single.php file

    Thread Starter matt-jo

    (@matt-jo)

    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

    Thread Starter matt-jo

    (@matt-jo)

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

    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.

    https://codex.www.ads-software.com/Template_Hierarchy

    to show categories in single posts, you can use:
    <?php the_category(', ') ?>
    https://codex.www.ads-software.com/Function_Reference/the_category

    and for tags:
    <?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
    https://codex.www.ads-software.com/Function_Reference/the_tags

    in single.php

    Thread Starter matt-jo

    (@matt-jo)

    ok thanks

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

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

    Thread Starter matt-jo

    (@matt-jo)

    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

    Thread Starter matt-jo

    (@matt-jo)

    anyone?

    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(); ?>

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How Do I Edit The Category Page’ is closed to new replies.