Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
(Quick update to say it happens without Types, it is what I would describe as an unexpected quirk of WordPress.)
Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
Sorry, just saw your question.
The current archive format is determined by your theme.
You can customise what is output for each post returned by the archive by creating a custom archive at Toolset > WordPress Archives.
It is very much like creating a View, which you have done already, so should be familiar, but let me know if you are stuck.
Thanks, Nigel.
I've managed to create this at hidden link
Quick question...
<h2>[wpv-archive-title]</h2>
This shows A-Z: A but I'd like it just to say "A". Any ideas for how to do this?
Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
What you need is to output the term name, and we don't have a shortcode for that which works in this context.
You can register a custom shortcode that will; here is a general purpose one you can use:
/**
* Register shortcode to output current taxonomy
* for use on taxonomy archive page outside or inside loop
* att['output'] string taxonomy | name (default) | slug | term_id | description | count | field (requres att['field'])
* att['field'] string key
*/
add_shortcode('taxonomy', function ($atts = [], $content = null) {
// provide defaults
$atts = shortcode_atts(
array(
'output' => 'name',
'field' => '',
),
$atts
);
extract($atts);
$return = '';
global $wp_query;
$obj = $wp_query->get_queried_object();
if ($output != 'field') {
$return = $obj->$output;
} else {
if (isset($field)) {
$return = get_term_meta($obj->term_id, $field, true);
}
}
return $return;
});
Add that as a code snippet at Toolset > Settings > Custom Code.
To output the term name use the taxonomy shortcode on its own without arguments, but for reference you can also use it like
[taxonomy output='taxonomy'] -- outputs the taxonomy slug
[taxonomy] -- outputs the term name (default)
[taxonomy output='count'] -- outputs the count of results
[taxonomy output='field' field='wpcf-colour'] -- outputs a 'colour' taxonomy custom field
This is perfect and has worked brilliantly - thanks so much! ? I have also learnt about the "custom shortcodes" feature which I had no idea existed.
Finally, before I leave you alone, can I ask how I can use Views to get rid of the search box at the bottom and the title "Archives" at the top of the page e.g. here: hidden link
Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
I don't think Views can help you here.
Any WordPress page is generated by a theme PHP template, so that page might be generated by an archive.php file, for example.
The only part of the page which Toolset replaces is the part which is output by the function the_content() in the theme file, effectively the post body of what's being displayed. Everything outside of that is output by the theme.
That would be the case with these elements you want to remove.
You would need to make a duplicate of the theme PHP template (e.g. archive.php) and add that to a child theme, where you can safely edit it, removing the parts that you do not want.
But, as I say, it is outside of Toolset's realm.