• Resolved Nessan Cleary

    (@nessan-cleary)


    Hi
    I need some more help with my website – nessancleary.co.uk. I’ve removed the taglines – Date posted, category and so on – which used to appear under the summary of each post on the front page of the blog when viewed on a desktop computer. But I’d now like to put the date for each post in the gap between the headline and the text. I know that someone’s already asked about this topic on the forum, but they didn’t post the answer.
    However, I notice that the mobile version still has a line with the date and ‘Leave a reply’. So, ideally I’d like to remove this line from the mobile version and have the date appear in the gap between the headline and the summary text in both the desktop and the mobile versions.
    Anyway, if anyone has any ideas on this, then I’d appreciate some help.
    Nessan

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

Viewing 15 replies - 1 through 15 (of 19 total)
  • Hi @nessan-cleary!

    It is possible to achieve what you’re after but will require you to experiment a little with the theme’s HTML.

    The first step is for you to set up a child theme.

    In case you’re unsure, the following guides provide a good introduction to child themes, including steps to set one up:

    After you have completed that step, copy the parent’s content.php file to your child theme’s directory and then open it in your favourite text/code editor.

    Locate the following code in that file:

    <footer class="entry-footer">
    	<?php colinear_entry_footer(); ?>
    </footer><!-- .entry-footer -->

    The above code outputs the post meta information that you hid beneath each of your posts. You can move that piece of code below the following line to move it just below the post’s title:

    </header><!-- .entry-header -->

    You may need to use CSS to tweak the style of the post meta information after following the above steps to move it.

    However, I notice that the mobile version still has a line with the date and ‘Leave a reply’.

    I can see that the Jetpack mobile theme is enabled on your site, which is why you’re seeing a different design to Colinear on mobile devices.

    It’s not necessary to enable the separate mobile theme as Colinear adapts to devices of different sizes by default.

    To disable the mobile theme, navigate to Jetpack -> Settings -> Writing and scroll down to the Theme Enhancements and the “Enable the Jetpack Mobile theme” option and turn that off.

    Let me know if the above guidance helps out or if you have any further questions!

    • This reply was modified 7 years, 1 month ago by Siobhan.
    Thread Starter Nessan Cleary

    (@nessan-cleary)

    Hi Siobhan,
    Thanks for your very detailed reply – I fell ill last week so it’s taken me a while to have a look at this.
    You gave me more to think about than I was expecting – I didn’t realise that the mobile site would be so different.
    Is there a way to keep the mobile site but lose the the date and ‘Leave a reply’ line? The reason is that I like the mobile site because it handles the menu very neatly and puts the search bar right at the top of the screen and I think this works better on the small screen then relying on the responsive layout.
    Thanks again for your help,
    Nessan

    Hi Nessan,

    I’m sorry to hear you’ve been ill! Hope you’ve made a full recovery now.

    You could use the following CSS to hide the date from the mobile theme:

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

    The following would then remove the “leave a reply” line:

    #reply-title {
        display: none;
    }

    Hope that’s helpful.

    Thread Starter Nessan Cleary

    (@nessan-cleary)

    Hi Siobhan,
    Thanks for getting back to me. I’ll have a go at this over the weekend – too much work to catch up on at the moment having been ill last week. It sounds fairly straightforward but I may come back to you next week!
    Best regards,
    Nessan

    Sounds good to me! Hope you’re able to catch up on everything this week.

    Thread Starter Nessan Cleary

    (@nessan-cleary)

    Hi Siobhan,
    I think that I need some more help. I finally got around to sorting out the website and followed your instructions, but I’ve obviously missed something. I’ve set up the child theme and enqueued that, which turned out to be easier than expected.
    However, I’ve not had much luck with the entry-footer. I moved it to underneath the header as you suggested but this hasn’t made any difference to the layout so I must have done something wrong.
    Also, the entry-footer code seems to include several lines – date and author, plus the category and tags. But I just want to put the date between the headline and the body text so I’m assuming that there must be a different line of code to do that – so I’d appreciate it if you have any further ideas.
    Thanks,
    Nessan

    Thread Starter Nessan Cleary

    (@nessan-cleary)

    OK,
    I’ve made some progress but could do with some advice. I have added this line:
    <?php the_date(); ?>
    to the content.php file in Colinear and this has done exactly what I was trying to do in the first place – put the date between the headline and the text. But this didn’t work when I tried to do it in the Colinear-child theme so I’ve obviously missed something in setting up the child theme – but what?
    Any ideas would be appreciated.
    Thanks,
    Nessan

    Moderator Kathryn Presner

    (@zoonini)

    @nessan-cleary are you still having troubles here?

    If changes to your child theme aren’t being reflected on the front end of your site, then that’s a definitely sign it isn’t quite set up right.

    Could you paste the contents of your child theme’s functions.php file into a Pastebin and link back to it from here so I can take a look? Thanks!

    Thread Starter Nessan Cleary

    (@nessan-cleary)

    Hi Kathryn,
    Thanks for your help. I’ve pasted the functions.php file into Pastebin – here’s the link:

    https://pastebin.com/4jxYHKyk

    The child theme did work in part for me – when I first set it up some of the changes that I had made to the site disappeared so I had to go back and redo them. But the date edit that Siobhan suggested didn’t work so I obviously missed something.
    Anyway, I’d appreciate any suggestions.
    Nessan

    Moderator Kathryn Presner

    (@zoonini)

    @nessan-cleary – I’d suggest you start fresh with your child theme’s functions.php. The current function is unnecessarily complicated and we might as well rule it out as a culprit.

    Erase everything you have in that file and instead add this simpler function for enqueuing your child theme’s styles:

    
    <?php 
    // Enqueue child theme's stylesheet
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    function my_theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    
    }

    Do not add a closing PHP tag.

    Let me know how it goes!

    Moderator Kathryn Presner

    (@zoonini)

    But the date edit that Siobhan suggested didn’t work so I obviously missed something.

    Could you also please double-check that you re-added both the CSS and the HTML changes Siobhan gave you?

    Thread Starter Nessan Cleary

    (@nessan-cleary)

    Hi Kathryn,
    Thanks for your help. This may seem like a silly question, but do you mean to copy the function for enqueuing the child theme exactly as you’ve written it, or do I need to substitute anything, such as my_theme for Colinear or Colinear child?
    Also, no need to worry about the CSS and HTML changes that Siobhan mentioned – I abandoned that once I realised that it wasn’t working. I’ve tried to avoid mucking around with any code too much since I’ve little idea what I’m doing and don’t want to mess the site up!
    Best regards,
    Nessan

    Moderator Kathryn Presner

    (@zoonini)

    @nessan-cleary Not a silly question at all! Literally just copy the function I gave you above, as I’ve written it. There’s no need to change anything, it’s a generic function that will work for almost any theme, as is.

    Let me know how it goes!

    Thread Starter Nessan Cleary

    (@nessan-cleary)

    Hi Kathryn,
    OK – I’ve replaced the content of the Functions.php file with the text that you gave me above. It doesn’t seem to have made any difference to the site.
    Nessan

    Moderator Kathryn Presner

    (@zoonini)

    @nessan-cleary OK, thanks for doing that, as it rules out any enqueueing issues.

    I’ve made some progress but could do with some advice. I have added this line:
    <?php the_date(); ?>
    to the content.php file in Colinear and this has done exactly what I was trying to do in the first place – put the date between the headline and the text. But this didn’t work when I tried to do it in the Colinear-child theme so I’ve obviously missed something in setting up the child theme – but what?

    The next thing I’m wondering is if it might be a file-path issue.

    Could you confirm that you put your child theme’s copy of content.php in a folder called template-parts in your child theme? The file path needs to exactly match that of the parent theme.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Placing date between headline and text on front page.’ is closed to new replies.