Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #150018
    NicolasBassand
    Participant

    Hello,
    I’m struggling to build my website. By default in the Catch Wheels Pro theme, for all posts, the author is displayed and the post dates are not displayed. I would like the opposite. For all my posts, I was able to hide the author but I fail to have the post dates displayed. I’ve looked everywhere in my theme customization options but there is no option to do. I also searched a lot on the Catch Themes forum and the internet in general to see if I could modify the function.php or style.css files, but I didn’t find anything that works. Thank you in advance for your help!
    Nicolas

    #150079
    Skandha
    Participant

    @nicolasbassand: For this you will need to create a child theme. If you do not know how to create a child theme you can use Generate Child Theme Plugin.

    After creating a child theme. Go to => Child Theme Folder => Open functions.php file and add the following Code.

    function catch_wheels_header_text() {
    		if ( is_front_page() ) {
    			$header_media_text = get_theme_mod( 'catch_wheels_header_media_text' );
    
    			echo wp_kses_post( $header_media_text );
    		} elseif ( is_singular() ) {
    			// Show By author.
    			echo '<div class="entry-meta">';
    
    			global $post;
    
    			$author_id=$post->post_author;
    			
    
    			echo get_the_modified_date();
    
    			$byline = sprintf(
    				/* translators: %s: post author */
    				__( '<span class="author-label screen-reader-text">By </span>%s', 'catch-wheels-pro' ),
    				'<span class="author vcard"><span>By</span><a class="url fn n" href="' . esc_url( get_author_posts_url( $author_id ) ) . '">' . esc_html( get_the_author_meta( 'display_name', $author_id ) ) . '</a></span>'
    			);
    
    			echo '<span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
    
    			echo '</div><!-- .entry-meta -->';
    		} elseif ( is_404() ) {
    			esc_html_e( 'It looks like nothing was found at this location. Maybe try one of the links below or a search?', 'catch-wheels-pro' );
    		} elseif( is_search() || ( class_exists( 'WooCommerce' ) && is_woocommerce() ) ) {
    			// No Header Media Text.
    		} else {
    			the_archive_description();
    		}
    	}

    Let me know if this works out!
    Kind Regards,
    Skandha

    #150219
    NicolasBassand
    Participant

    Hi Skandha,

    Thank you for your help. The code solved my problem only partially:

    1) The post date now appears on the post page just below the title. With additional CSS, I managed to have it displayed with a bigger font and with my title font instead of my body content font: http://trustandride.com/serie-le-bol-dor-2017-et-la-magie-de-lendurance-1-6

    2) However the date that appears is the date of the last modification on the article. I would like to have the publication date displayed. I see “get_the_modified_date()” in your code. How can I modify it to have the right date displayed?

    3) Despite looking into the page code with my web browser inspector, I haven’t managed to have this post date displayed in white. It’s automatically in black but i’d like to change this so that the date can be seen over the pictures in background. In my CSS code, the only code I found I can change to have the date in white color is this :

    h1, h2, h3, h4, h5, h6, .drop-cap:first-letter, .slider-content-wrapper .entry-content, .slider-content-wrapper .entry-summary, .no-header-media-image .custom-header .entry-title, .no-header-media-image .custom-header .entry-summary, .no-header-media-image .custom-header .entry-content, .entry-footer .entry-meta span span, .custom-header .entry-content, .custom-header .entry-summary, blockquote, .ctis-finished-notice {
    color: #111111;
    }

    However, since that includes titles h1, h2, h3, h4, h5, h6, it then also change all the titles on my home white from black to white, which I don’t want.
    Do you know the solution?

    4) The date appears on all the pages, that is to say the articles and other static pages (contact, about, privacy policy, etc) when I only want it on the articles. Is there a way?

    5) Last but not least, I said in the beginning that this code you sent me only solved my problem partially because I would like the post dates to be displayed everywhere on the website, and not just once you click on the article and open the article page.
    I would like the dates of the articles displayed on the front page, for both the hero article and the featured articles (http://trustandride.com/), and also on the category pages when the list of articles are shown (http://trustandride.com/articles/le-coin-racing). It is possible?
    For example, on your NepalBuzz Pro theme (https://catchthemes.com/demo/nepalbuzz/) or Christmas Bell theme (https://catchthemes.com/demo/christmas-bell/), the post dates are nicely displayed also on the front pages.

    Sorry for this long response and several questions. I have to say this Catch Wheels Pro theme is giving me a a hard time. It’s a pity because I feel the style options I’m trying to get out of it are pretty basic for a website.

    Thank you again,

    Nicolas

    #150305
    Skandha
    Participant

    @nicolasbassand: To have publication date displayed instead of modification date replace get_the_modified_date(); by get_the_date();

    Go to => Appearance => Customize => Additional CSS and add the following CSS Code.
    /* To change the color of date to white */

    .entry-meta {
        display:none;
    }

    You seem to have figured out a way not to display dates in static pages. Have you?

    Let me know if this helps you out!
    Kind Regards,
    Skandha

    #150345
    NicolasBassand
    Participant

    Hi Skandha,

    Thank you for sharing the function that displays the publication date instead of the modification date. It works well.

    To change the color of date to white, I modified the CSS code you suggested (which just hides the date) and I entered instead:

    .entry-meta {
    color: #FFFFFF
    }

    That works well. Since that CSS code only concerns the entry meta, i.e. the date here, it doesn’t mess up with the color of my titles.

    The questions 4) and 5) of my previous response are still accurate. It would be great if you have any insights:
    4) I haven’t managed to hide from the static pages (my static pages are in my new footer for example).
    5) I would like the dates of the articles displayed on the front page, for both the hero article and the featured articles (http://trustandride.com/), and also for each article when the articles are seen in a list on the category pages (http://trustandride.com/articles/le-coin-racing).

    Thank you,

    Nicolas

    #150356
    Skandha
    Participant

    @nicolasbassand: To remove dates from static page
    Go to => Appearance => Customize => Additional CSS and add the following CSS Code.

    .page .entry-meta {
        display:none;
    }

    To display dates on articles front page and category page
    Go to => Child Theme Folder => Create new folder template-parts => Create another folder inside template-parts and name it content => Create new file content.php and paste the code from this link.

    To display dates on hero content
    Go to => Child Theme Folder => template-parts => Create new folder hero-content => Create new file post-type-hero.php and paste the code from this link.

    To display dates on featured content
    Go to => Child Theme Folder => template-parts => Create new folder featured-content => Create new file content-featured.php and paste the code from this link.

    Let me know if this works out!
    Kind Regards,
    Skandha

    #150582
    Skandha
    Participant

    @nicolasbassand: To display dates on articles front page and category page
    Go to => Child Theme Folder => Create new folder template-parts => Create another folder inside template-parts and name it content => Create new file content.php and paste the code from this link.

    Now, the date should be displayed in the featured content section as well.

    Let me know if this works out!
    Kind Regards,
    Skandha

    #150595
    NicolasBassand
    Participant

    Hi Skandha,

    I made the modification and it works well! Thank you very much!

    Nicolas

    #151072
    Skandha
    Participant

    @nicolasbassand: Go to => Appearance => Customize => Additional CSS and add the following CSS Code.
    To change of the color of date

    .single-post .entry-meta, h1.entry-title {
       color:#fff;
    }

    To separate the categories with ‘>’
    Replace <?php catch_wheels_entry_category(); ?> in the template-parts/content/content.php file in the child theme folder with <?php the_category('>'); ?>

    To change the font of the comment title
    Go to => Appearance => Customize => Additional CSS and add the following CSS Code.

    #comments #reply-title {
        font-family: Josefin Sans;
    }

    Let me know if this works out!
    Kind Regards,
    Skandha

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Display post dates on my website’ is closed to new replies.