Site logo

Archived topic

Placement of Meta Data on Single Post

11 replies · Started by James on February 5, 2018

Viewing posts 1–12 of 12

Hi Tom,

I assume the answer is using CSS what I'm not sure is how to code it.

What I am trying to achieve is to have the following on my single blog post page in this order:

Breadcrumbs (check this is appearing first)
Feature Image (check this is showing second)
Category
Post Title
Author
Post Date

Ultimately it would be great on the last two to have it show as follows assuming I'm author and date is today:

by James Peter | Published February 5th, 2018

Today I am seeing all these elements except the category and currently it shows date then author.

Is there a way or method to change the order and show the category under the image prior to title?

Thanks in advance for your guidance on this.

James

Hi James,

Can you link us to to what you currently have?

Thanks!

Absolutely Leo is there a way I submit that to you other than pasting link in this message?

If you edit your original post, you'll see a website URL field. Only us admins can see it, so your URL will stay private :)

Tom thank you I have edited the original post and added the link.

For now I have the title appearing above the picture I am comfortable with how to move it below the picture hoping to place the category under the image before author and date

As well in a prior post I asked about adding breadcrumbs with Yoast and it worked but now wonder (as you'll see) how to move it from the top of the page below the image?

Sorry if I've asked this additional question in the wrong place I can repost the question on that original post if you prefer.

I appreciate all the help

James

Hey James,

So you're wanting the categories to move from below the post to below the featured image?

I'm not seeing breadcrumbs at all - how are you currently adding them?

Hi Tom sorry for the delayed response. In a separate thread I have been working with Leo regarding the breadcrumbs he has provided me php code to be used in the hooks section which worked, then didn't and this weekend with new code expect it will ... I too saw that the breadcrumbs went away.

I also didn't realize the category showed at the bottom of the post (I assume that is where there is an icon then the category name)?

My hope was to show the category the post belonged to under the picture yes and (now after seeing how it appears) hoping to drop the icon and change the size/color if needed (I assume css for that).

I hope everything above makes sense thanks.

James

Hi James,

Should be pretty easy!

First, disable the categories in Customize > Layout > Blog.

Then, add this PHP snippet:

add_action( 'generate_after_entry_header', 'tu_cats_after_image', 20 );
function tu_cats_after_image() {
    $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) );
    if ( $categories_list ) {
        printf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', // WPCS: XSS ok, sanitization ok.
            esc_html_x( 'Categories', 'Used before category names.', 'generatepress' ),
            $categories_list
        );
    }
}

Let me know if this does it or not :)

Thanks Tom where do I add the PHP snippet please?

Thanks Leo, seems the reviews recently on Code Snippets aren't too favorable might try as I know nothing about php (other than I think I should probably take some time to learn the basics).

As it relates to child theme do you recommend doing one and if so what is the best way to create child theme for GP+

Part of why I went with GP+ was somewhere I had read child theme wasn't necessary (which I understand if I'm adding lots of custom code makes sense to have a child)

James

This archived topic is closed to new replies.