• Resolved zer0blok

    (@zer0blok)


    Hi.
    I currently have ‘Posted on” on my posts, showing the date, and also operating as a link.

    I’d simply like to remove the link, while keeping the information. (Ideally by editing in child-theme file rather than css.) So the ‘posted on’ information appears, but isn’t a link.

    -As a secondary request, if it’s also possible to remove the day (keeping the month and year) please let me know.

    Thanks in advance
    ??

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • @zer0blok

    -As a secondary request, if it’s also possible to remove the day (keeping the month and year) please let me know.

    You can set a custom date format in Settings > General, under Date format: F, Y

    I currently have ‘Posted on” on my posts, showing the date, and also operating as a link.

    I’d simply like to remove the link, while keeping the information. (Ideally by editing in child-theme file rather than css.) So the ‘posted on’ information appears, but isn’t a link.

    You can override the function scrawl_posted_on() function in your child theme. You’ll find find the original in /inc/template-tags.php

    Thread Starter zer0blok

    (@zer0blok)

    Thanks @zoonini,

    F, Y in Settings does the job ??

    You can override the function scrawl_posted_on() function in your child theme. You’ll find find the original in /inc/template-tags.php

    I’ve found this file and the block of code… but i don’t understand how to “override” the function. Could you identify the code and what needs to be done, please? -where the link is, and where i can change the ‘Posted on’ text (e.g. to ‘Posted in’).

    endif;
    
    if ( ! function_exists( 'scrawl_posted_on' ) ) :
    /**
     * Prints HTML with meta information for the current post-date/time and author.
     */
    function scrawl_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() )
    	);
    
    	if ( is_single() && scrawl_categorized_blog() ) {
    		printf( __( '<span class="posted-on">Posted on %1$s</span><span class="byline"> by %3$s</span><span class="category-links"> in %2$s</span>', 'scrawl' ),
    			sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
    				esc_url( get_permalink() ),
    				$time_string
    			),
    			get_the_category_list( __( ', ', 'scrawl' ) ),
    			sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
    				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    				esc_html( get_the_author() )
    			)
    		);
    	} else {
    		printf( __( '<span class="posted-on">Posted on %1$s</span><span class="byline"> by %2$s</span>', 'scrawl' ),
    			sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
    				esc_url( get_permalink() ),
    				$time_string
    			),
    			sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
    				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    				esc_html( get_the_author() )
    			)
    		);
    	}
    }
    
    Thread Starter zer0blok

    (@zer0blok)

    OK, so i couldn’t achieve the original intention in terms of how the ‘Posted on’-meta functions. I decided in the end to hide the meta in CSS:

    .posted-on {
    display: none;
    }

    With thanks
    ??

    Glad you found a workaround.

    Hi Kathryn,

    I’ve put sensitive information on my posts on this forum because I can’t restore a back up. Is there a way to edit?! Whoops

    Moderator Kathryn Presner

    (@zoonini)

    @slv1982 – Hi! It’s very unlikely anyone’s ever going to spot a reply when you post in an old, resolved thread, about an unrelated issue. If you need help removing sensitive information, please visit the #forums channel in www.ads-software.com Slack and ask for a moderator’s help there. Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove Link (and Edit) from ‘Posted on’’ is closed to new replies.