Viewing 6 posts - 16 through 21 (of 21 total)
Kent

Checkbox in Custom Fields Not Working

I need to create custom-fields with Checkbox so that user can choose several values to be displayed in their listing. (Example: Forms of Payment Accepted: Cash, Venmo, Paypal, Zelle, Bitcoin) All the custom-field values are there in the backend to be selected, but ONLY the 1st checked value displays in the front end with the shortcode. The other values are not displayed in the front end at all but still remains checked in the backend. How do I fix this?

Created: February 11, 2020 at 6:44 am


  • Kent
    February 18, 2020 at 3:30 am

    STILL NEED THE CODE…


  • Kent
    February 18, 2020 at 3:42 am

    Can give me the code so i can copy and paste it. C’mon man. This should not ha’ve even been an issue.

    I’m working on my user dashboard and backend right now and looks ridiculous and convoluted to make the user choose from 5 individual fields when they should just be using 1 checkbox field to select multiple values at one time!

    You said you fixed the problem and created the code… so give it to me.

  • Mark Fail
    Mark Fail
    February 18, 2020 at 4:40 am

    file: framework/new_class/ppt_6_shortcodes.php

    function pptv9_shortcode_customfield()

    
    function pptv9_shortcode_customfield($atts, $content = null){ global $wpdb, $wp_query, $CORE, $post;
    
    extract( shortcode_atts( array( 'field' => '', 'default' => '0' ), $atts ) );
    
    if( ( isset($_REQUEST['action']) && !in_array($_REQUEST['action'], array("contactform", "sendgift", "invitechat")) )
    
    || isset($_REQUEST['preview_id']) || isset($_REQUEST['elementor_library']) ){
    $f = $field;
    }else{
    
    $f = get_post_meta($post->ID, $field, true);
    if($f == ""){
    return "";
    }elseif(is_array($f)){
    $j = "";
    foreach($f as $g){
    if($g == "--"){ continue; }
    $j .= $g.", ";
    }
    $j = substr($j,0,-2);
    $f = $j;
    }
    }
    
    return $f;
    }
    
    
  • Mark Fail
    Mark Fail
    February 18, 2020 at 4:44 am

    The above is assuming your using the custom field short code within Elementor – as per Jame’s video.

    If your using another setup, please explain with screenshots.


  • Kent
    February 22, 2020 at 9:15 pm

    Mark,

    Thank you for the code… It works like a charm.

    Also, I want to apologize to you for being a bit of a jerk. I’ll just blame my irritability on no sleep and 20hour coding binges. lol

    Thanks again Mark. You are a standup guy.

Copyright © 2010-2020 PremiumPress Limited.

secure payments