- This topic has 27 replies, 5 voices, and was last updated 5 years, 7 months ago by Tom.
-
AuthorPosts
-
August 30, 2018 at 3:21 pm #664765TomLead DeveloperLead Developer
Good news! ๐
August 31, 2018 at 10:18 am #665428generatorOk, sorry it still exists on other pages, I thought it will be gone on all pages (35) now.
August 31, 2018 at 11:02 am #665467TomLead DeveloperLead DeveloperAh, well that’s a different issue. It’s a single post, but you’ve removed the title, author and date.
I suppose you could remove the class that tells Google to look for those elements:
add_filter( 'post_class', function( $classes ) { $classes = array_diff( $classes, array( 'hentry' ) ); return $classes; } );
August 31, 2018 at 11:14 am #665483generatorOk, that worked, thank you!
But I think I did not remove these parts on purpose. Where could I add them again?
The posts title is not deactivated in the backend, and I thought author and date are already coming from the posts date, and the users name.August 31, 2018 at 6:16 pm #665652TomLead DeveloperLead DeveloperThe post meta can be removed in “Customize > Layout > Blog”. If they’re activated in there, maybe you have some custom functions added?
The content title is likely removed using a custom function as well.
September 1, 2018 at 9:05 am #666058generator“blog” has one drop down “Content type” and is set to “full” (“complete” (translated)).
Following the functions php. The front page title thing is only because one day my title from the front pages title field disappeared.
If this problem is to complicated, please let me know how much this would be for a job./*front page title*/ add_filter( 'document_title_parts', function( $title ) { if ( is_front_page() ) { $title['title'] = 'My Custom Title'; } return $title; } ); /*fix hatom missing author date*/ add_filter( 'post_class', function( $classes ) { $classes = array_diff( $classes, array( 'hentry' ) ); return $classes; } ); /**Portfolio Tab**/ function post_type_projects() { register_post_type( 'portfolio', array( 'label' => __('Portfolio'), 'public' => true, 'show_ui' => true, 'supports' => array( 'title', 'editor', 'post-thumbnails', 'custom-fields', 'revisions') ) ); register_taxonomy( 'category-p', 'portfolio', array( 'hierarchical' => false, 'label' => __('Projects'), 'query_var' => 'category-p', 'rewrite' => array('slug' => 'category-p' ) ) ); } add_action('init', 'post_type_projects'); function wpbeginner_remove_version() { return ''; } add_filter('the_generator', 'wpbeginner_remove_version'); /*emoji*/ function remove_emoji() { remove_action('wp_head', 'print_emoji_detection_script', 7); remove_action('admin_print_scripts', 'print_emoji_detection_script'); remove_action('admin_print_styles', 'print_emoji_styles'); remove_action('wp_print_styles', 'print_emoji_styles'); remove_filter('the_content_feed', 'wp_staticize_emoji'); remove_filter('comment_text_rss', 'wp_staticize_emoji'); remove_filter('wp_mail', 'wp_staticize_emoji_for_email'); add_filter('tiny_mce_plugins', 'remove_tinymce_emoji'); } add_action('init', 'remove_emoji'); function remove_tinymce_emoji($plugins) { if (!is_array($plugins)) { return array(); } return array_diff($plugins, array( 'wpemoji' )); } /*Footer width*/ add_filter('generate_footer_widget_1_width','tu_custom_footer_1_width'); function tu_custom_footer_1_width(){ // Return the percentage of this widget width - 25% in this case return'25'; } add_filter('generate_footer_widget_2_width','tu_custom_footer_1_width'); function tu_custom_footer_2_width(){ // Return the percentage of this widget width - 25% in this case return'25'; } add_filter('generate_footer_widget_3_width','tu_custom_footer_1_width'); function tu_custom_footer_3_width(){ // Return the percentage of this widget width - 25% in this case return'50'; } /*fonts*/ add_filter( 'generate_typography_default_fonts', 'tu_add_local_fonts' ); function tu_add_local_fonts( $fonts ) { $fonts[] = 'Raleway'; return $fonts; }
September 1, 2018 at 7:37 pm #666309TomLead DeveloperLead DeveloperAh, if you’re using a custom post type they won’t load by default.
Check out this solution: https://generatepress.com/forums/topic/post-meta-category-tags-does-not-display-for-custom-post-type/#post-661738
September 3, 2018 at 8:52 am #667577generatorNow I have the title, but not author and date.
In “customizer > layout > blog” author and date are checked.Do I have to turn on some other settings somewhere?
September 3, 2018 at 9:50 am #667629TomLead DeveloperLead DeveloperYou’d have to use the code I linked to above. Those elements only display on the
post
post type by default.September 4, 2018 at 9:43 am #668570generatorThe code from the link above, yes I already entered it into the functions.php:
EDIT: I will simply delete this custom post, and create new blog posts during the next time…
<?php // // // Your code goes below // define( 'WP_AUTO_UPDATE_CORE', false ); /*front page title*/ add_filter( 'document_title_parts', function( $title ) { if ( is_front_page() ) { $title['title'] = 'My Custom Title'; } return $title; } ); /**Portfolio Tab**/ function post_type_projects() { register_post_type( 'portfolio', array( 'label' => __('Portfolio'), 'public' => true, 'show_ui' => true, 'supports' => array( 'title', 'editor', 'post-thumbnails', 'custom-fields', 'revisions') ) ); register_taxonomy( 'category-p', 'portfolio', array( 'hierarchical' => false, 'label' => __('Projects'), 'query_var' => 'category-p', 'rewrite' => array('slug' => 'category-p' ) ) ); } add_action('init', 'post_type_projects'); /*add post meta manually because of costum post type*/ add_action( 'generate_after_entry_title', function() { $post_types = array( 'one-post-type', 'another-post-type', ); if ( in_array( get_post_type(), $post_types ) ) : ?> <div class="entry-meta"> <?php generate_posted_on(); ?> </div><!-- .entry-meta --> <?php endif; } ); add_action( 'generate_after_entry_content', function() { $post_types = array( 'one-post-type', 'another-post-type', ); if ( in_array( get_post_type(), $post_types ) ) : ?> <footer class="entry-meta"> <?php generate_entry_meta(); if ( is_single() ) { generate_content_nav( 'nav-below' ); } ?> </footer><!-- .entry-meta --> <?php endif; } ); function wpbeginner_remove_version() { return ''; } add_filter('the_generator', 'wpbeginner_remove_version'); /*emoji*/ function remove_emoji() { remove_action('wp_head', 'print_emoji_detection_script', 7); remove_action('admin_print_scripts', 'print_emoji_detection_script'); remove_action('admin_print_styles', 'print_emoji_styles'); remove_action('wp_print_styles', 'print_emoji_styles'); remove_filter('the_content_feed', 'wp_staticize_emoji'); remove_filter('comment_text_rss', 'wp_staticize_emoji'); remove_filter('wp_mail', 'wp_staticize_emoji_for_email'); add_filter('tiny_mce_plugins', 'remove_tinymce_emoji'); } add_action('init', 'remove_emoji'); function remove_tinymce_emoji($plugins) { if (!is_array($plugins)) { return array(); } return array_diff($plugins, array( 'wpemoji' )); } /*Footer width*/ add_filter('generate_footer_widget_1_width','tu_custom_footer_1_width'); function tu_custom_footer_1_width(){ // Return the percentage of this widget width - 25% in this case return'25'; } add_filter('generate_footer_widget_2_width','tu_custom_footer_1_width'); function tu_custom_footer_2_width(){ // Return the percentage of this widget width - 25% in this case return'25'; } add_filter('generate_footer_widget_3_width','tu_custom_footer_1_width'); function tu_custom_footer_3_width(){ // Return the percentage of this widget width - 25% in this case return'50'; } /*fonts*/ add_filter( 'generate_typography_default_fonts', 'tu_add_local_fonts' ); function tu_add_local_fonts( $fonts ) { $fonts[] = 'Raleway'; return $fonts; }
September 4, 2018 at 5:23 pm #668845TomLead DeveloperLead DeveloperYou need to update the post types with the names of your types.
So if your post type is named
portfolio
, you would replace this:$post_types = array( 'one-post-type', 'another-post-type', );
With this:
$post_types = array( 'portfolio', );
September 6, 2018 at 4:18 am #670169generatorOops, ok that worked.
Thank you very much for your effort!!September 6, 2018 at 8:42 am #670397TomLead DeveloperLead DeveloperYou’re welcome ๐
-
AuthorPosts
- You must be logged in to reply to this topic.