- This topic has 7 replies, 2 voices, and was last updated 6 years, 1 month ago by
Tom.
-
AuthorPosts
-
October 25, 2017 at 1:51 am #409697
estrategy
Hi there,
I’m using the theme for our corporate blog. And making a child theme so that updates won’t ruin blog.
So far so good functions.php works like a charm, but i also changed the file template-tags.php in the subfolder ‘inc’. I created that subfolder in the child theme folder and put the file there. Somehow this file isn’t picked up and therefore the changes in that file are not showing. How can i fix this?
I also have some CSS that is added to the ‘custom css’ option in the WordPress admin. That CSS is also not recognized in the child theme. But it is there in the admin. How can i fix this?
October 25, 2017 at 9:42 am #410052Tom
Lead DeveloperLead DeveloperIt’s not a good idea to overwrite any GP files outside the root folder.
For example, in GP 2.0, template-tags.php doesn’t even exist anymore. Which functions did you edit? There should be ways to do it in your functions.php.
As for CSS, why not add it to your style.css file in your child theme?
October 26, 2017 at 12:22 am #410456estrategy
As for CSS, why not add it to your style.css file in your child theme?
That worked, not all styles are showed correctly but that will be fixed.
For example, in GP 2.0, template-tags.php doesn’t even exist anymore. Which functions did you edit? There should be ways to do it in your functions.php.
Ik changed this:
Removed the <h1> from the archive title in the build the archive title<header class="page-header<?php if ( is_author() ) echo ' clearfix';?>"> <?php do_action( 'generate_before_archive_title' ); ?> <!-- this is were the H1 was --> <?php the_archive_title(); ?> <!-- this is were the H1 was --> <?php do_action( 'generate_after_archive_title' ); ?>
Added nl2br for author and some text and <b> in the line after that.
if ( get_the_author_meta('description') && is_author() ) : // If a user has filled out their decscription show a bio on their entries echo '<div class="author-info">' . nl2br(get_the_author_meta('description')) . '</div><hr>'; echo '<div class="author-info">Alle berichten geschreven door: <b>' . get_the_author() . '</b></div><hr>';
Added H1 tot the the_post()
the_post(); //Hier is de H1 toegevoegd voor de vcard $title = sprintf( '%1$s<h1 class="page-title"><span class="vcard">%2$s</span></h1>',
This was done so the site looks consistent troughout. I don’t have any experience placing this kind of things in the functions.php. Thats why i did it here.
October 26, 2017 at 10:23 pm #411047Tom
Lead DeveloperLead Developer1. The archive title should have
<h1>
elements by default – is that not the case on your site?2. Try this: https://generatepress.com/forums/topic/user-archive-bio-field-texts-no-line-breaks/#post-377705
3. Not too sure what you’re doing here – which element are you adding an H1 to?
October 27, 2017 at 12:09 am #411096estrategy
1. The archive title should have <h1> elements by default – is that not the case on your site?
Nope, the blog is a sidepart of the corporate website. Without the H1 it fits more to the style of the main site. The blog is not going to be indexed by search engines so that shouldn’t be a problem. I will look into css if I can bypass this without removing the H1. Will keep you updated.
2. Try this: https://generatepress.com/forums/topic/user-archive-bio-field-texts-no-line-breaks/#post-377705
Will look into this, thank you!
3. Not too sure what you’re doing here – which element are you adding an H1 to?
I’m adding the H1 around the vcard here
October 27, 2017 at 9:12 pm #411712Tom
Lead DeveloperLead DeveloperWhich vcard exactly? It’s important to only have one H1 on each page.
October 30, 2017 at 1:58 am #412788estrategy
Which vcard exactly? It’s important to only have one H1 on each page.
In the one below. But with your answer about the function I managed to put this piece also into the functions file, so that issue is fixed (at least for now).
if ( ! function_exists( 'generate_filter_the_archive_title' ) ) : /** * Alter the_archive_title() function to match our original archive title function * * @since 1.3.45 */ add_filter( 'get_the_archive_title','generate_filter_the_archive_title' ); function generate_filter_the_archive_title( $title ) { if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } elseif ( is_author() ) { /* Queue the first post, that way we know * what author we're dealing with (if that is the case). */ the_post(); $title = sprintf( '%1$s<span class="vcard">%2$s</span>', get_avatar( get_the_author_meta( 'ID' ), 75 ), get_the_author() ); /* Since we called the_post() above, we need to * rewind the loop back to the beginning that way * we can run the loop properly, in full. */ rewind_posts(); } return $title; } endif;
October 30, 2017 at 9:06 am #413044Tom
Lead DeveloperLead DeveloperBetter to use your own function instead of overwriting the GP function:
add_filter( 'get_the_archive_title', 'tu_custom_archive_title', 15 ); function tu_custom_archive_title( $title ) { if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } elseif ( is_author() ) { /* Queue the first post, that way we know * what author we're dealing with (if that is the case). */ the_post(); $title = sprintf( '%1$s<span class="vcard">%2$s</span>', get_avatar( get_the_author_meta( 'ID' ), 75 ), get_the_author() ); /* Since we called the_post() above, we need to * rewind the loop back to the beginning that way * we can run the loop properly, in full. */ rewind_posts(); } return $title; }
Then make any necessary changes to it 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.