• Resolved marieservais

    (@marieservais)


    I would like to change single post header so that it looks exactly the same as on blog/archives pages : category above the title, same title, same meta under the title.
    How could this be achieved ? I really like the look of it.

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

Viewing 11 replies - 1 through 11 (of 11 total)
  • Andre

    (@andre-jutras)

    You could do that; the change would of course need to be done with a Child Theme because it requires some coding to be moved around in a few files. You will have to be comfortable in doing that, but it can be done.

    If you decide to do this, I can tell you what files will need copied into your child theme and the location of the code that needs to move.

    Thread Starter marieservais

    (@marieservais)

    Thanks very much ! Since it’s more than just css, I guessed it had to be through a child theme, which I am quite familiar with. But I’ve been looking through the files and my problem is finding what pieces of code can be moved and where to insert them to achieve the result without breaking the whole thing ?? I’d be grateful for your help on this point !

    Andre

    (@andre-jutras)

    Give me a few minutes to open the theme up — it’s been awhile ?? and I will give you the files and line numbers of the code.

    Best thing about a child theme is that if you mess things up (and I’ve done that), it doesn’t affect the main theme.

    Just to confirm, you are wanting the single category name above the title on the full post like the blog home page shows and you want the line under the title as well?

    Thread Starter marieservais

    (@marieservais)

    Thanks ! And take your time ;)… And indeed, being able to play with a child theme and leave the original intact is a great thing !
    As for the look of it, yes I would like it to be exactly the same between blog home page and single post: category name above the full post, line under title and meta.

    Andre

    (@andre-jutras)

    Actually, this wasn’t as difficult as first thought, although I’ve not actually tried this with a child theme, so hoping this works out.

    Start with the line under the title. Add this to your child theme stylesheet or to the Additional CSS tab of the customizer:

    .single .entry-title::after {
        content: "";
        display: block;
        background-color: rgba(0,0,0,0.25);
        height: 1px;
        width: 15%;
        position: relative;
        margin: 20px 0;
    }

    In your child theme, add a folder structure like this:

    \template-parts\post\

    In the post subfolder, copy the main theme’s content-single.php file into it. When done, your structure will now look like this:

    \template-parts\post\content-single.php

    …and then open it and find line 18:

    <header class="entry-header">	
       <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
    </header>

    Just before that first php line of code (after the opening header tag), add this:

    <?php 
    // get our first category
    if( esc_attr(get_theme_mod( 'pureblog_show_summary_cat', true ) ) ) {
    pureblog_get_first_cat_name();
    }
    ?>

    That should change the full post header area to look like the blog and archive style.

    NOTE: When copying files over from the main theme (parent theme), you will want to make sure the child theme structure of folders and files match what the parent theme has.

    Thread Starter marieservais

    (@marieservais)

    Great! Exactly what I was looking for. Thanks a lot, Andre. ??
    I have a last question on the subject: now that the category name is diplayed above the full post, how can I suppress it from the meta line under the title, other than by using css ?

    • This reply was modified 5 years, 11 months ago by marieservais.
    Andre

    (@andre-jutras)

    Hmmm….thought I had a setting in the customizer to disable each of the meta info items; must be in the pro version (will have to look).

    But you have a couple options. In the content-single.php file that you edited, a little further below you see:

    pureblog_categories();

    Remove that. Or, you can add this CSS code:

    .cat-links {
        display: none;
    }
    Thread Starter marieservais

    (@marieservais)

    Fine, I’ll try that !

    There are options in the customizer for each of the meta info items, but they don’t seem to work… Actually I tried them in the first place, but it made no difference.

    Great theme all the same ! Thanks for your help !!

    Andre

    (@andre-jutras)

    hmmmm…. odd they are not working because they did before. I will have to look into this for both the free and pro. But thank you for the comment about the theme. If you decide later to do a rating and review, we’d love to hear any suggestions to make the theme even better.

    I’m guessing everything is OK with this topic and resolved?

    Thread Starter marieservais

    (@marieservais)

    Sure, I’ll do it once the site is full on.
    And for the topic: Ok and resolved ??

    Andre

    (@andre-jutras)

    Awesome, and thanks!
    I already made some notes to fix a few things and also add Gutenberg support as well.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Change Single Post Header’ is closed to new replies.