Support

Account

Forum Replies Created

  • …or if it would be a suitable alternative…

    Would it be possible to have a placeholder text field (or similar) that gets updated with the content of one or more of the select field values… the only way I can think to do this would be with JS, perhaps with an onchange value? It would then need to be limited to only those visible fields within the field group.

    Basically, I need a field that displays the current selection(s) of this group that can be displayed both in a page template and hopefully in the back-end custom post type’s edit.php. There’s too many conditional fields etc. to consider doing it field-by-field.

    To clarify, this is a field group, within a field group i.e. ‘Field Type’ is set as group.

  • Hi John, many thanks for the above… still struggling a tad…

    In case it helps, my repeater fields are structured as follows:

    Field Group = company_information

    Sub field 1 = company_group (value as integer)
    Sub field 2 = company_name (text)
    Sub field 3 = company_website (optional) – to be wrapped around company_name if present.

    So ideally, I’d end up with the following

    <h2>group_name 1</h2>

    • company_name 1
    • company_name 2 – with a link around it if company_website has a value

    <h2>group_name 2</h2>

    • company_name 3
    • company_name 4 – with a link around it if company_website has a value

    Thanks so much thus far – feels almost within reach!

  • Nearly there – thank you!

    I basically just want to be able to output a grouped list, for each group – if that makes sense? The above renders: Group Name and Person Name for every entry.

    End result being:

    Group 1

    • Name 1
    • Name 2
    • Name 3

    Group 2

    • Name 4
    • Name 5
    • Name 6

    Group 3

    • Name 7
    • Name 8
    • Name 9
  • Got it! Slight adaptation of John’s code above – basically, for anyone else that might need it, I needed to pull in the value for $term_id from the ID given in the sub_field, so:

    $term = get_term_by('id', $term_id, 'wgd_jurisdiction');
    					echo $term->name;

    Becomes…

    $term = get_term_by('id', get_sub_field('ques_jurisdiction'), 'wgd_jurisdiction');
    echo($term->name);

    Hopefully this helps others – thanks again John for pointing me in the right direction.

  • Hi John, many thanks for getting back to me. I’ve tried to implement the above, but must be missing something… current template code is below, but I’m still just getting the ID (not desired) + Paragraph text (desired) outputted.

    Many thanks in advance…

    <header class="entry-header">
    <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
    </header>
    
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        
            <div class="entry-content">
                  
                    <?php
    			          
                if( have_rows('question_answers') ):
                
                    while ( have_rows('question_answers') ) : the_row();
                ?>
                
                    <div class="country-answer">
                        <h2><?php $country = get_sub_field('ques_jurisdiction');
    					echo $country;
    					$term = get_term_by('id', $term_id, 'wgd_jurisdiction');
    					echo $term->name;
    					?>
                        
                        </h2>   
    
                        <?php the_sub_field('ques_answer');?>
        
                    </div>
        
                <?php
                    endwhile;
                
                else :
                
                    // no rows found
                
                endif;
    			
    			
                
                ?>
                
                <?php  ?>
        
            </div>
        
        </article>
  • Just to follow-up after a bit of extra digging, I need to keep the term as returning ID, as opposed to object to avoid conflicts elsewhere.

    So in essence, I’m looking for a way to pull in the taxonomy value (name) and display that instead of the ID.

  • Hi James,

    Think some progress – would you (or anyone else) have any recommendations as to how to best batch import? 800k rows, or so!

    My concern would be the creation of duplicate posts though for Restaurants and/or Suppliers.

    My CSV is structured as follows;

    1) Restaurant Name 2) Supplier 3) Country 4) Region 5) Speciality 6) Speciality Sub-section

    Each row is repeated where there is a unique record, so for some restaurants, I end up with multiple instances of the same.

    Ultimately, I would like to establish the relationship Restaurant <–> Supplier and then filter using the other fields.

    Not sure if a clever use of taxonomies is the right way forward or not? But initially I’ve got 1 & 2 as post types, with the rest as custom fields and another (relationship) custom field for each CPT.

    Could e-mail over a sample of the data if that would help?

    Thanks thus far and in advance – appreciate this is my own headache to solve!

  • Thanks James, that’s great – I’ll let you know how I get on!

  • Many thanks – simple fix for my idiocy!

  • Hi John,

    Thanks for getting back to me.

    I anticipate quite a few of these, so don’t think it would be feasible to create an archive page for each one…

    As you can probably tell, my knowledge of WP is pretty limited! But one thought I had was to see if upon entry, a custom field option could be essentially duplicated and mapped to a Tag?

    Am example setup of these would be…

    Custom Field = Country Select

    1. UK
    2. USA
    3. France

    …and so on.

    I’d want them to be able to click ‘France’ within a post and it retrieve all posts related to that field selection.

    If when added to an option within the custom field setup, UK, France, USA etc were added as Tags, this would solve it?

    Apologies if I’m missing the point/ limitations…

    Thanks again.

Viewing 10 posts - 1 through 10 (of 10 total)