0

I'm using a theme from Envato Market (Painting). What I need to do is to replace a generic page title which is displayed when I open a category page from Shop or Portfolio, with the actual name of the category. The developer of the theme said that I can’t dynamically display the title. But in the same time I see that the breadcrumbs shows the correct title of the category. Could the page title be grabbed from the breadcrumbs and displayed? Or maybe there is another solution. Can someone help me and explain it for a noob? Thank you!

  • You can use plugins for it. For example wordpress.org/plugins/wordpress-seo to update archive templates title with custom. – Anton Lukin Aug 29 '17 at 15:15
  • Thank you for suggestion but after seeing the plugin's page I realized that I don't even know where to start... – catalin66ro Aug 29 '17 at 16:43
0

You can change the code in the theme files to do this. Open the file category.php (if this file doesn't exist, try archive.php) and replace the text you want to change with single_cat_title()

Here is the documentation

However these changes will be overwritten if you update your theme

You can create a child theme or use plugins to get around this.

  • Don't change theme templates if you want to update your theme in future. Create child theme or write your plugin better – Anton Lukin Aug 29 '17 at 15:24
  • Great, is working, but now I need to add some style to it. Can you tell me how? Remember, I'm a complete noob in php. – catalin66ro Aug 29 '17 at 16:41
  • My lines looks like this: elseif( is_tax() ): $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $title = esc_html__(single_cat_title($prefix = '', $display = true),'painting'); painting_custom_subtitle_section( $title ); It's correct? – catalin66ro Aug 29 '17 at 16:48
  • You can do this a number of ways. Since you are a beginner, the easiest, is to wrap your call with some inline style. Change your call to single_cat_title() to '<span style="[whatever style rules here]">' . single_cat_title() . '</span>' – Jeremy Muckel Aug 29 '17 at 16:50
  • Also it is customary to check my answer as correct since I did solve your original question. Thank you – Jeremy Muckel Aug 29 '17 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.