[Resolved] Move category meta

Home Forums Support Move category meta

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #970599
    GG

    Hi. I use this code to show the (updated date and) category on my front page and archives. Could you kindly help me modify it so that it also shows the same on single posts? I want to disable the category at the bottom of the posts. Thanks in advance. (Could you also advise if the same code is the one outputting updated date on single posts?)

    add_filter( 'generate_post_date_output', function( $output, $time_string ) {
    	$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
    
    	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    		$time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">%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() )
    	);
    
    	printf( '<span class="posted-on">%s</span> ', // WPCS: XSS ok, sanitization ok.
    		$time_string
    	);
    
            if ( ! is_single() ) {
                $categories_list = get_the_category_list( ', ' );
        
                if ( $categories_list ) {
                    echo '<span class="cat-links"><span class="gp-icon icon-categories">
                            <svg viewBox="0 0 512 512" aria-hidden="true" role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                                <path d="M0 112c0-26.51 21.49-48 48-48h110.014a48 48 0 0 1 43.592 27.907l12.349 26.791A16 16 0 0 0 228.486 128H464c26.51 0 48 21.49 48 48v224c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112z" fill-rule="nonzero"></path>
                            </svg>
                        </span>' . $categories_list . '</span>';
                }
            }
    }, 10, 2 );  

    2. To another unrelated question, I recently sent a request to have my previous account moved to this one after rebranding. However, I saw that someone made a purchase of the theme through the affiliate link of my previous account (which I had shared extensively). Is there a way to 1. redeem this amount? I rather signed up for affiliate to help me get extra money to extend the annual license and wouldn’t mind topping up the balance.

    #971224
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Try this:

    add_filter( 'generate_post_date_output', function( $output, $time_string ) {
        $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
    
        if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
            $time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">%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() )
        );
    
        return sprintf( '<span class="posted-on">%s</span> ',
            $time_string
        );
    }, 10, 2 );
    
    add_filter( 'generate_header_entry_meta_items', function() {
        return array(
            'author',
            'date',
            'categories',
        );
    } );
    
    add_filter( 'generate_footer_entry_meta_items', function( $items ) {
        return array_diff( $items, [ 'categories' ] );
    } );

    2. Can you shoot me an email with your old affiliate username and your new one?

    Thanks!

    #971455
    GG

    Thanks. I have sent the email.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.