• Hi!

    I would like to add a Categoy field to the Edit/Submit Campaign.
    So far I have made ??the following changes in shortcode-submit.php file :
    – I added this line in the register_fields() function:

    'category' => array(
    				'label'       => __( 'Category', 'atcf' ),
    				'default'     => null,
    				'type'        => 'select_cat',
    				'editable'    => false,
    				'placeholder' => null,
    				'required'    => true,
    				'priority'    => 6
    			),

    – I added this line in the function __construct() :
    add_action( 'atcf_shortcode_submit_field_select_cat', 'atcf_shortcode_submit_field_select_cat', 10, 4 );
    – I created the function to generate the html code:

    [...]
    ?>
    	<p class="atcf-submit-campaign-<?php echo esc_attr( $key ); ?>">
    		<label for="<?php echo esc_attr( $key ); ?>"><?php echo apply_filters( 'atcf_shortcode_submit_field_label_' . $key, esc_attr( $field[ 'label' ] ) ); ?></label>
    
    		<select name="<?php echo esc_attr( $key ); ?>">
    
    		<?php
    				$terms = get_terms( 'download_category' );
    				if ( count( $terms ) > 0 ) {
    						/*echo "<option value=''>" . __( 'Show all categories', 'edd' ) . "</option>";*/
    						foreach ( $terms as $term ) {
    							$selected = isset( $_GET['download_category'] ) && $_GET['download_category'] == $term->slug ? ' selected="selected"' : '';
    							echo '<option value="' . esc_attr( $term->slug ) . '"' . $selected . '>' . esc_html( $term->name ) .' (' . $term->count .')</option>';
    						}
    				}
    		?>
    		</select>
    	</p>
    <?php
    }
    [...]

    The problem is, like you will know, that actually the selected category is stored in the BBDD as a extra field (campaign_category) but not as the real category.
    Can you help me please?
    Thank you!

    https://www.ads-software.com/plugins/appthemer-crowdfunding/

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add category field to Edit/Submit Campaign?’ is closed to new replies.