- This topic has 9 replies, 3 voices, and was last updated 5 years, 7 months ago by Tom.
-
AuthorPosts
-
June 26, 2017 at 3:19 pm #339561dmmaso
Hi,
There is some way in the blog page and in the pages of a single post to show the categories and the date above the title, in this order.Thank you
Daniel
June 26, 2017 at 8:09 pm #339689TomLead DeveloperLead DeveloperWhat about the author and tags? Do you want them to appear above as well?
June 27, 2017 at 12:57 am #339817dmmasoNo. I just want category, date and title in this order
June 28, 2017 at 1:02 am #340500TomLead DeveloperLead DeveloperFirst, we’d need to move it above the title:
add_action( 'after_setup_theme','tu_move_posted_on' ); function tu_move_posted_on() { remove_action( 'generate_after_entry_title', 'generate_post_meta' ); add_action( 'generate_before_entry_title', 'generate_post_meta' ); add_filter( 'generate_category_list_output', '__return_false' ); }
Then you’d need to do this:
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; }
June 28, 2017 at 2:10 am #340545dmmasoGreat Tom !! thank you very much again!!
June 28, 2017 at 9:19 am #340773TomLead DeveloperLead DeveloperYou’re welcome ๐
August 10, 2018 at 9:28 am #645077IHi Tom I just want to move category & tags above title. I have date and author at bottom of post, I can’t seem to make this work.
August 10, 2018 at 4:23 pm #645360TomLead DeveloperLead DeveloperI wonder if you could do something as simple as this:
remove_action( 'generate_after_entry_content', 'generate_footer_meta' ); add_action( 'generate_before_entry_title', 'generate_footer_meta' );
Let me know ๐
August 11, 2018 at 5:24 am #645619IIt works but includes all the meta data, rather than just category and tag, and it doesn’t remove the bottom. I’ll keep trying.
August 11, 2018 at 10:25 am #645837TomLead DeveloperLead DeveloperLet’s try this instead then:
add_filter( 'generate_show_categories', '__return_false' ); add_filter( 'generate_show_tags', '__return_false' ); add_action( 'generate_before_entry_title', function() { $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 ); } $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) ); if ( $tags_list ) { printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', // WPCS: XSS ok, sanitization ok. esc_html_x( 'Tags', 'Used before tag names.', 'generatepress' ), $tags_list ); } } );
-
AuthorPosts
- You must be logged in to reply to this topic.