• Resolved ab

    (@maml)


    Hi,
    How can I remove the category which is shown under post titles?
    Next to where is says “published on” and “by”
    I’m sure the category wouldn’t show there before, maybe I changed something in the css to make it show now or maybe its a feature of the new update. Anybody know how to remove it?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter ab

    (@maml)

    I’ve found this bit of code in the template tags pho file which I think is responsible, but deleting it does nothing. Any ideas?

    echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
        //displaying author and category in home page
        if(is_home()){ echo '<span>';
        	          echo '&nbsp'.__('Category:','pure-simple').'<span class="">'.'&nbsp'.get_the_category_list( __( ', ', 'pure-simple' ) ).' </span>';}
        }
    endif;
    Thread Starter ab

    (@maml)

    I’ve just realised the reason why deleting the code does nothing is because for some reason the site is still using the template tags file from the parent theme. I don’t know why the one I’ve copied into the child theme directory isn’t being used, is there something else I need to do?

    Theme Author Styled Themes

    (@gejay)

    Hi there,

    Bring puresimple_posted_on() function in child theme functions.php file and remove this code:

    //displaying author and category in home page
        if(is_home()){ echo '<span>';
                    echo '&nbsp'.__('Category:','pure-simple').'<span class="">'.'&nbsp'.get_the_category_list( __( ', ', 'pure-simple' ) ).' </span>';}
        }

    Thanks

    Thread Starter ab

    (@maml)

    Hi
    Thanks for your reply, so I should paste this code..

    function puresimple_posted_on() {
    	$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
    	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    		$time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
    	}

    from template-tags.php into the child theme function file,
    then delete this code

    //displaying author and category in home page
        if(is_home()){ echo '<span>';
                    echo '&nbsp'.__('Category:','pure-simple').'<span class="">'.'&nbsp'.get_the_category_list( __( ', ', 'pure-simple' ) ).' </span>';}
        }

    from the template-tags.php file ?

    Thread Starter ab

    (@maml)

    adding that code into the functions file gives me an syntax error, can you tell me exactly what I need to copy into the functions file and where?
    This is the full text of my functions file

    <?php
    
    // Exit if accessed directly
    
    if ( !defined( 'ABSPATH' ) ) exit;
    
    // BEGIN ENQUEUE PARENT ACTION
    
    // AUTO GENERATED - Do not modify or remove comment markers above or below:
    
    if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
    
        function chld_thm_cfg_parent_css() {
    
            wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css' );
    
        }
    
    endif;
    
    add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
    
    remove_all_filters('wp_title');
    
    // END ENQUEUE PARENT ACTION
    
    function load_fonts() {
    
                wp_register_style('et-googleFonts', 'https://fonts.googleapis.com/css?family=Cinzel|Cinzel+Decorative');
    
                wp_enqueue_style( 'et-googleFonts');
    
            }
    
        add_action('wp_print_styles', 'load_fonts');

    thank you for your help

    Theme Author Styled Themes

    (@gejay)

    Hi There,

    First copy this below functions and paste in to child theme functions.php file. Then find your string that need to be canged.

    function puresimple_posted_on() {
     $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
     if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
      $time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
     }
    
     $time_string = sprintf( $time_string,
      esc_attr( get_the_date( 'c' ) ),
      esc_html( get_the_date() ),
      esc_attr( get_the_modified_date( 'c' ) ),
      esc_html( get_the_modified_date() )
     );
    
     $posted_on = sprintf(
      __( 'Published on %s', 'pure-simple' ),
      '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
     );
    
     $byline = sprintf(
      _x( 'by %s', 'post author', 'pure-simple' ),
      '<span class="author vcard"><a href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
     );
    
     echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
        //displaying author and category in home page
        if(is_home()){ echo '<span class="category-name">';
                   echo '&nbsp'.__('Category:','pure-simple').'<span class="">'.'&nbsp'.get_the_category_list( __( ', ', 'pure-simple' ) ).' </span>';}
        }

    Note: If you are familiar with basic of php coding then only try this code, otherwise you will be facing error. It will be better if you get help from developer.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove "category" from line under post title’ is closed to new replies.