[Support request] Remove time from date

Home Forums Support [Support request] Remove time from date

Home Forums Support Remove time from date

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #523573
    Florian

    Hi Tom,
    some months ago, I asked to add the time to the date in my blog under every article-excerpt.
    Here you can see: http://www.it-antwort.de

    Under the title, you can red “18. März 2018 um 22:00 Uhr”.

    Now I would like to remove “um 22:00 Uhr” (the time), but I don’t know how.

    Please help me, best regards

    Florian

    #523829
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You likely just need to remove the function that was given to you to add that time.

    Do you know the function? Or can you link to the post where it was given to you?

    #523894
    Florian

    Thats’s the problem 🙁 I don’t know the post and I also don’t know whether it was a post of me or just a post of another person I read 🙁

    #524143
    Leo
    Staff
    Customer Support

    Can you copy and paste the function here?

    #524367
    Florian
    <?php
    /**
     * All of your custom PHP can go in this file below this commented area
     * Caution: Be sure to have access to your server via File Manager or FTP in case an error occurs
     * Happy editing!
     */
    /**
    add_action( 'after_setup_theme','generate_move_single_page_header' );
    function generate_move_single_page_header()
    {
        remove_action('generate_before_content','generate_featured_page_header_inside_single', 10);
        add_action('generate_after_entry_header','generate_featured_page_header_inside_single', 10);
    }
    */
    add_action( 'wp_print_scripts', 'mantle_remove_sticky', 100 );
    function mantle_remove_sticky()
    {
      wp_dequeue_script( 'stickynav' );
    }
    
    add_action('after_setup_theme','generate_copyright_remove_default_message');
    function generate_copyright_remove_default_message()
    {
    		
    	remove_action( 'generate_credits', 'generate_add_footer_info' );
    	remove_action( 'generate_copyright_line','generate_add_login_attribution' );
    }
    
    /**
     * Add the custom copyright
     * @since 0.1
     */
    add_action('generate_credits','generate_copyright_add_custom_message');
    function generate_copyright_add_custom_message()
    {
    ?>
    	© 2016 - 2018 IT-Antwort.de <br> GeneratePress by Tom Usborne
    <?php
    }
    
    if ( ! function_exists( 'generate_posted_on' ) ) :
    /**
     * Prints HTML with meta information for the current post-date/time and author.
     */
    function generate_posted_on() {
    
    	if ( 'post' !== get_post_type() ) 
    		return;
    	
    	$date = apply_filters( 'generate_post_date', true );
    	$author = apply_filters( 'generate_post_author', true );
    		
    	$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s um %6$s</time>';
    	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) )
    		$time_string .= '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s at %5$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() ),
    		esc_attr( get_the_modified_time() ),
    		esc_attr( get_the_time() )
    	);
    	
    	// If our date is enabled, show it
    	if ( $date ) :
    		printf( '<span class="posted-on">%1$s</span>',
    			sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
    				esc_url( get_permalink() ),
    				esc_attr( get_the_time() ),
    				$time_string
    			)
    		);
    	endif;
    	
    	// If our author is enabled, show it
    	if ( $author ) :
    		printf( ' <span class="byline">%1$s</span>',
    			sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
    				__( 'by','generate'),
    				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    				esc_attr( sprintf( __( 'View all posts by %s', 'generate' ), get_the_author() ) ),
    				esc_html( get_the_author() )
    			)
    		);
    	endif;
    	
    }
    endif;
    
    add_filter( 'generate_post_author','generate_modify_author_display' );
    function generate_modify_author_display()
    {
        if ( is_single() )
            return true;
    
        return false;
    }
    
    add_action('wp','generate_customize_post_images');
    function generate_customize_post_images()
    {
    	$generate_settings = wp_parse_args(
    		get_option( 'generate_blog_settings', array() ),
    		generate_blog_get_defaults()
    	);
    
    	if ( 'post-image-above-header' == $generate_settings['post_image_position'] ) :
    		add_action( 'generate_after_entry_header', 'generate_blog_post_image' );
    		add_action( 'generate_before_content', 'generate_blog_post_image' );
    
    		if ( function_exists('generate_page_header_post_image') ) :
    			add_action( 'generate_after_entry_header', 'generate_page_header_post_image' );
    			add_action( 'generate_before_content', 'generate_page_header_post_image' );
    		endif;
    	endif;
    }
    

    Thats everything I have 😀

    #524690
    Tom
    Lead Developer
    Lead Developer

    Try removing this part:

    if ( ! function_exists( 'generate_posted_on' ) ) :
    /**
     * Prints HTML with meta information for the current post-date/time and author.
     */
    function generate_posted_on() {
    
    	if ( 'post' !== get_post_type() ) 
    		return;
    	
    	$date = apply_filters( 'generate_post_date', true );
    	$author = apply_filters( 'generate_post_author', true );
    		
    	$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s um %6$s</time>';
    	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) )
    		$time_string .= '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s at %5$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() ),
    		esc_attr( get_the_modified_time() ),
    		esc_attr( get_the_time() )
    	);
    	
    	// If our date is enabled, show it
    	if ( $date ) :
    		printf( '<span class="posted-on">%1$s</span>',
    			sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
    				esc_url( get_permalink() ),
    				esc_attr( get_the_time() ),
    				$time_string
    			)
    		);
    	endif;
    	
    	// If our author is enabled, show it
    	if ( $author ) :
    		printf( ' <span class="byline">%1$s</span>',
    			sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
    				__( 'by','generate'),
    				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    				esc_attr( sprintf( __( 'View all posts by %s', 'generate' ), get_the_author() ) ),
    				esc_html( get_the_author() )
    			)
    		);
    	endif;
    	
    }
    endif;
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.