Black Friday sale! Get 25% off WPSP Pro! Discount automatically applied at checkout.

[Support request] Remove from Meta date?

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Remove from Meta date?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5044
    christopher
    Participant

    Is it possible to remove the link from the date, when displaying that meta? It links to the post as well as the title, but I’d just prefer the title of the post to go there and the date link to be nothing .. so I can style it differently than other <a> links on the site.

    And sorry, secondary question: did I read somewhere you are planning on offering some sort of “Updated: <date>” on the lists, as in when an article or post is updated we can profile that on our home page or other lists?

    Love it all regardless, using it like crazy on https://fitnessgoat.com/.

    Thanks,
    Chris

    #5049
    Tom
    Keymaster

    Hey Chris,

    To remove the link and show the updated date, you can do this:

    add_filter( 'wpsp_date_output', 'tu_wpsp_updated_date_first' );
    function tu_wpsp_updated_date_first() {
    	$time_string = '';
    	
    	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    		$time_string .= '<time class="wp-show-posts-updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
    	}
    	
    	$time_string .= '<time class="wp-show-posts-entry-date published" datetime="%1$s" itemprop="datePublished">%2$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 our date is enabled, show it
    	$output = sprintf(
    		'<span class="wp-show-posts-posted-on wp-show-posts-meta">
    			%1$s
    		</span>',
    		$time_string
    	);
    
    	return $output;
    	
    }

    Then add this CSS:

    .wp-show-posts-updated {
        display: inline-block;
    }
    
    .wp-show-posts-updated + .wp-show-posts-entry-date {
        display: none;
    }

    Let me know if this helps or not 🙂

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