Forum Replies Created

Viewing 6 replies - 16 through 21 (of 21 total)
  • Thread Starter floi13

    (@floi13)

    Hi Yordan,

    Ah, I forgot to mention that, thanks for doing so #thumbsup

    Thread Starter floi13

    (@floi13)

    Solved the issue by doing the following things. Maybe this helps someone who tries a similar thing.

    1) add this code to my functions.php:

    function dynamic_select_field_values ( $scanned_tag, $replace ) {  
        if($scanned_tag['name'] != 'YOUR CF7 FIELDNAME HERE') return $scanned_tag;
        $rows = get_posts(
        	array ( 
    	     'post_type' => 'YOUR CPT NAME HERE',  
    	     'numberposts' => -1,  
    	     'orderby' => 'title',  
    	     'order' => 'ASC' 
            )
        );
        if(!$rows) return $scanned_tag;
        foreach($rows as $row) {  
            $scanned_tag['raw_values'][] = $row->post_title . '|' . $row->post_title;
        }
        $pipes = new WPCF7_Pipes($scanned_tag['raw_values']);
        $scanned_tag['values'] = $pipes->collect_befores();
        $scanned_tag['pipes'] = $pipes;
      
        return $scanned_tag;  
    }  
    add_filter( 'wpcf7_form_tag', 'dynamic_select_field_values', 10, 2);

    2) add an element with corresponding name in your CF7 form:
    [radio YOUR CF7 FIELDNAME HERE use_label_element default:1]

    Thread Starter floi13

    (@floi13)

    @bcworkz thanks for your reply.
    Haven’t thought of terms; perhaps that’s the way to go for me. If I understand you right it could be something like
    – I create a custom posttype
    – I create a custom taxonomy for that posttype

    I then create a template with a term field and if the id equals 12345, show the content related to that id.

    Am I correct so far?

    Thread Starter floi13

    (@floi13)

    Hi bcworkz,

    You’re right; the plan b wasn’t something I wanted to do, it was more of an alternative.
    Hmz, a separate request you say.. perhaps I’ll drop the whole api approach and just display all wanted data through standard WordPress loop.

    Owell, you learn and you try (=

    • This reply was modified 7 years ago by floi13.
    Thread Starter floi13

    (@floi13)

    Hi Anurag,

    This doesn’t seem to do anything, except limit the result to 10 items (total is 16). Maybe a screenshot of the api result helps: https://bit.ly/2UGE5iH. The ‘work-api’ returns the ID of the chosen taxonomy.
    As a plan B I could write some logic like ‘if ID is 6, taxonomy is abc’, but that’s not something I would like to do.

    • This reply was modified 7 years ago by floi13.
    • This reply was modified 7 years ago by floi13.
    • This reply was modified 7 years ago by floi13.
    Forum: Fixing WordPress
    In reply to: ACF true/false
    Thread Starter floi13

    (@floi13)

    After some tinkering about, it looks like it has to do something with the default value.
    When I uncheck all projects (set to false) and check only one project (set one to true), I get 3 times a ‘boolean:false’ back and one ‘boolean:true’.

    Seems correct so far…

    But what if I want to use the default ‘true’ value?

Viewing 6 replies - 16 through 21 (of 21 total)