• Hi to all!
    My intention is to build a private, non-public website where I plan to insert (as posts) places I would like to visit. Something like “extended” Bucket list. It’s open public right now because I need your help.

    I created couple categories, enter couple posts… And then I realized I’m gonna have some problems with “location”. Every post should have Address, City, State, Country (provinces, territories, regions… I’m gonna deal with it later) so I can list all posts with the same selected City/State/… So, they have to be “linkable”, “selectable” (don’t know what would be the correct term… please, bear with me…) so by selecting the value of the City, related to the place in the post, I want to list all places (posts) with that specific city. Very similar to Categories: e.g. if you select category “Movies” you’ll get a list of all posts with the category “Movies”.
    First I thought to use Tags. It’s doable. It would work, but only if I use city, state and country tags, and no other tags. Otherwise it’s gonna be mess of mixed location tags and other tags. Also, I can’t control the tag sorting because they are sorted alphabetically… I abandoned this plan.
    After doing some research I found ACF plugin. Installed, created a Group, added custom fields… Everything looks cool – until I realized I can’t see it on the front page. Ok, back to research.
    I kinda solved the “problem” but it looks weird, doesn’t seems right to me. Using Appearance/Editor I added the following code into templet-parts -> post -> content.php

    echo '<div style="font-size: .9em; margin-bottom: 25px; padding: 25px;">';
    
    if (get_field('google_map')) {
    	$google_map = get_field('google_map');
    	echo '<a href="'.$google_map.'">Google Map</a><br />';
    }
    
    if (get_field('google_street_view')) {
    	$gsv = get_field('google_street_view');
    	echo '<a href="'.$gsv.'">Google Street View</a><br />';
    }
    		
    if (get_field('facebook')) {
    	$facebook = get_field('facebook');
    	echo '<a href="'.$facebook.'" rel="category tag">Facebook</a><br />';
    }
    
    if (get_field('city')) {
    	$city = get_field('city');
    	echo 'City: '.$city.'<br />';
    }
    
    if (get_field('state')) {
    	$state = get_field('state');
    	echo 'State: '.$state.'<br />';
    }
    		
    if (get_field('country')) {
    	$country = get_field('country');
    	echo 'Country: '.$country.'<br />';
    }
    
    echo '</div>';
    

    I, actually, solved the issue just partially. It works fine for Google Map and Street View links, but not for city, state and country fields. I know there are several different options for field types in ACF but can’t figure out how to make them searchable, e.g. if I enter Iowa for the State field, and click on the State (value) link, to get the list of all posts that have value “Iowa” in custom field “States” (Somehow I have a feeling I’m confusing you more and more, right?)

    So, how to do this? Or, if you would suggest different approach, please let me know.

    Thanks for any help.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ammtar

    (@ammtar)

    Just a sec after I submitted the topic I got an idea (if possible) to have 3 groups of tags. Group 1: City, Group 2: State, Group 3: other tags (like the one we use now). And then show the Groups somehow separately, something like
    [Group 1 tag], [Group 2 tag]
    [Group 3 tag]

    Riverside, Iowa
    James T. Kirk, Star Trek, Spock, SciFi

    Is this possible?

    Thread Starter ammtar

    (@ammtar)

    bump…
    ??

    Thread Starter ammtar

    (@ammtar)

    Still nothing? C’mon guys, I know you got this!
    ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trying to make custom fields clickable, to search for same values’ is closed to new replies.