• Resolved seelevelmktg

    (@seelevelmktg)


    I’d like to display only the blog post date of the current blog post being viewed in the sidebar, no other information. Is this possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Aldo Latino

    (@aldolat)

    Yes, you can use jQuery for this. You will have to modify a couple of files of your theme and add a new one. Here are the three steps.

    First step

    Open the file functions.php of your current theme and add these lines at the end of the file:

    
    function pis_scripts() {
    	wp_enqueue_script( 'pis-script', get_template_directory_uri() . '/js/pis-modifications.js', array( 'jquery' ), '20170331', true );
    }
    add_action( 'wp_enqueue_scripts', 'pis_scripts' );
    

    Be careful to paste them before the closing ?> PHP tag, if it’s present. Usually PHP developers prefer to omit it.

    Save the file and upload it to your server.

    Second step

    Create a new folder js inside the root folder of your current theme (if it’s not present already), create a new file pis-modifications.js, and paste these lines:

    
    jQuery(document).ready(function($){
    	$(".posts-in-sidebar .current-post .pis-excerpt").addClass('pis-hide');
    	$(".posts-in-sidebar .current-post .pis-author").addClass('pis-hide');
    	$(".posts-in-sidebar .current-post .pis-separator").addClass('pis-hide');
    	$(".posts-in-sidebar .current-post .pis-author").addClass('pis-hide');
    	$(".posts-in-sidebar .current-post .pis-comments").addClass('pis-hide');
    	$(".posts-in-sidebar .current-post .pis-categories-links").addClass('pis-hide');
    	$(".posts-in-sidebar .current-post .pis-tags-links").addClass('pis-hide');
    });
    

    Save the file and upload it to your server.

    Third step

    Open the file style.css of your current theme and add these lines at the end of the file:

    
    .pis-hide {
    	display: none;
    }
    

    Save the file and upload it to your server.

    Go to your site and test the results. The sidebar should display only the title of the post and the date. This modification will be applied only to the current post being viewed in the sidebar, as you requested.

    Let me know, please.

    Plugin Author Aldo Latino

    (@aldolat)

    Hello @seelevelmktg,
    have you tried what I wrote?
    Let me know, please. ??

    Plugin Author Aldo Latino

    (@aldolat)

    I close this request. Please, feel free to open a new one, if needed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show only blog post date’ is closed to new replies.