- This topic has 4 replies, 2 voices, and was last updated 6 years, 4 months ago by
Tom.
-
AuthorPosts
-
July 21, 2017 at 11:05 am #352865
Mildmac SA (ESA78960895)
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/July 21, 2017 at 1:11 pm #352933Mildmac SA (ESA78960895)
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
RafaelJuly 21, 2017 at 8:53 pm #353062Tom
Lead DeveloperLead DeveloperHi 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 🙂
July 24, 2017 at 1:27 am #353881Mildmac SA (ESA78960895)
Thanks Tom.
Everything rightJuly 24, 2017 at 10:44 am #354148Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.