Skip Navigation

[Resolved] Add taxonomy term as a title in an archive page

This support ticket is created 2 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by kostasT 2 years, 7 months ago.

Assisted by: Waqar.

Author
Posts
#2180625
WordPress Archives Block ‹ Photographers — WordPress.png

I want to add the title of a custom taxonomy term to an archive page. I created 2 demo sites and I tried to see how it is done on the them:

hidden link
hidden link

but apart from the WordPress Search and Output, I don't see how the title is inserted. And in the photographers' case, the archive is also used as a custom post archive with a different title in that case.

I follow the tutorial

https://toolset.com/course-lesson/creating-a-custom-archive-page/

but I didn't find how to insert the title above the archive.

I'm attaching the backend of the photographers' archive.

Thank you!

#2180801

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

When a WordPress Archive is customized through Toolset, it only affects the archive's content area and not the header and footer sections around it.

In the demo website links that you shared, the archive titles are also being added by the active themes, Blocksy and Astra, respectively.

To include the archive's title within the content area controlled through Toolset, you can register a custom shortcode, for example:


add_shortcode( 'custom_archive_title', 'custom_archive_title_func');
function custom_archive_title_func($atts)
{
	$a = shortcode_atts( array(
		'before' => '',
		'after' => ''
	), $atts );

	$output = get_the_archive_title();

	return $a['before'].$output.$a['after'];
}

The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.

After that, you can use this shortcode in your Toolset archive, like this:


[custom_archive_title before='<h1>' after='</h1>']

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2180897

Hi,

How did you add the archive title using the Astra theme? Do you mean that you added in the PHP templates of the theme or the child theme?

#2180947

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

> How did you add the archive title using the Astra theme?
> Do you mean that you added in the PHP templates of the theme or the child theme?

- No extra steps are needed to show the archive title, because the Astra theme shows it by default.

#2181063

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.