0

Recently I've done a nice taxonomy system on my WordPress website. Created also the taxonomy archive template files, so wherever I'm listing the taxonomies I can click on them and will bring me on a results page filtered by the clicked taxonomy.

I'm wondering if the same situation can be reproduced also with custom fields? I know custom fields are different by hierarchical tackle, but just wondering.

2
  • What is "hierarchical tackle"? What situation do you want to reproduce, exactly?
    – s_ha_dum
    Commented Mar 26, 2013 at 20:11
  • Custom fields has different hierarchy than taxonomies. I would like to click on a custom field value (word) and to bring me on a page with results filtered by that custom field, kind an archive.
    – user17408
    Commented Mar 26, 2013 at 20:25

1 Answer 1

0

WordPress does not support by default custom_fields archive like for taxonomies (yeah, taxonomies can have categories) but we can create a destination page with page template (linked from the listed custom_field) and added a searching on the custom_field, like this (from the listing page):

<?php
if (get_post_meta($post->ID,'_my_meta',TRUE)) :
    $key_meta = get_post_meta($post->ID,'_my_meta',TRUE);
endif;
?>
<a href="<?php bloginfo('url'); ?>/?s=<?php echo $key_meta[meta_field]; ?>"><?php echo $key_meta[meta_field]; ?></a>

The destination page's layout we can customize by preferences.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.