Site logo

Archived topic

Change the order of elements in the detail post page

4 replies · Started by Mildmac SA (ESA78960895) on July 21, 2017

Viewing posts 1–5 of 5

Hello, how can I change the order of elements in the detail post page?
Now I have the title first, the author, then the image, the content and at the end categories and links to previous and next posts.
And I want, as in the capture attached, first image, then title, author and categories, then the content and take out the links (I don't want them)

I have a GP child theme and I know it should be easy, editing or copying single.php or something like that, but don't know how to do it. I played around with options in the blog module, but I just can enable or disable elements, but not changing appearing order. ANd I couldn´t find it in the forum.

Thanks
CAPTURE (what I want): http://vvv.terraaurea.com/wp-content/uploads/capture-post.jpg
Page: http://vvv.terraaurea.com/daniel-rubio-en-el-radio-la-vida-biloba/

And one more thing: how can I set the blog page to order posts by date (newest to oldest).

http://vvv.terraaurea.com/blog/

It should do it, but it don´t . I have other pages in the site made with elementor to filter some posts and they do it, but in the main theme blog page it doesn´t happen. It show them in the order I created them, even if after I change the publish date to someone before. I had to create some posts recently, but they are suppossed to be published 2 or 3 years ago, and they always appear the first ones.
I checked all blog options in the personalization, but no succeed
Thanks
Rafael

Hi there,

First, remove the current categories:

add_action( 'after_setup_theme','tu_remove_categories' );
function tu_remove_categories() {
    add_filter( 'generate_category_list_output', '__return_false' );
}

Then add them after the date:

add_filter( 'generate_post_date_output', 'tu_categories_to_date' );
function tu_categories_to_date( $output ) {
    $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) );
    $categories_list = sprintf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
        _x( 'Categories', 'Used before category names.', 'generatepress' ),
        $categories_list
    );

    return $categories_list . $output;
}

The hide the post navigation with some CSS:

.single .post-navigation {
    display: none;
}

As for the order, WP by default will sort your posts by date. Maybe you have a plugin manipulating the order? You can try deactivating them one by one to see if one of them is causing it.

Let me know :)

Thanks Tom.
Everything right

You're welcome :)

This archived topic is closed to new replies.