farinspace / wpalchemy

Thin framework for wordpress
http://wpalchemy.com/
Other
415 stars 112 forks source link

js fullcalender Repeater metabox wordpress #96

Closed rihankhan closed 9 years ago

rihankhan commented 9 years ago

Hello, I have this code for a repeater that enables me to repeat metabox on my wordpress site,. But it is not dislaying :(

Any ideas ? Thanks in advance Best regards

metabox.php==

<?php global $event_date_metabox; ?>

    <?php while($mb->have_fields_and_multi('project-events')): ?>

                <?php $mb->the_group_open(); ?>

                <?php $row_pos = ($i & 1) ? 'odd' : 'even'; ?>
            <div class="elaphas_meta_titles">
                <?php $mb->the_field('project-title'); ?>
                <span class="label-election fl-left">Choice <i class="fa fa-check-square-o"></i></span>
                <label for="<?php $mb->the_name(); ?>"><?php _e( 'Title', ELEPHAS_TXT_DOMAIN ); ?></label>
            </div>
            <div class="elaphas_meta_sub-titles">
                <span><?php _e( 'Title of the project', ELEPHAS_TXT_DOMAIN ); ?></span>
            </div>
            <input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/>

            <div class="elaphas_meta_titles">
                <label for=""><?php _e( 'D&eacute;but', ELEPHAS_TXT_DOMAIN ); ?></label>
            </div>
            <div class="elaphas_meta_sub-titles">
                <span><?php _e( 'Start date of the event', ELEPHAS_TXT_DOMAIN ); ?></span>
            </div>

            <?php $event_date_metabox->the_field('event_start'); ?>
            <input class="pie_field date-field" type="text" id="<?php $event_date_metabox->the_name(); ?>" name="<?php $event_date_metabox->the_name(); ?>" value="<?php $event_date_metabox->the_value(); ?>"/>

            <div class="elaphas_meta_titles">
                <label for=""><?php _e( 'Fin', ELEPHAS_TXT_DOMAIN ); ?></label>
            </div>
            <div class="elaphas_meta_sub-titles">
                <span><?php _e( 'End date of the event', ELEPHAS_TXT_DOMAIN ); ?></span>
            </div>

            <?php $event_date_metabox->the_field('event_end'); ?>
            <input class="pie_field date-field" type="text" id="<?php $event_date_metabox->the_name(); ?>" name="<?php $event_date_metabox->the_name(); ?>" value="<?php $event_date_metabox->the_value(); ?>"/>

            <span class="button-election fl-right"><a href="#" class="dodelete button">Delete Choice <i class="fa fa-trash-o"></i></a></span>

                <?php $mb->the_group_close(); ?>

            <?php endwhile; ?>
            <p style="margin-bottom:15px; padding-top:5px;"> <a href="#" class="docopy-project-events button"><i class="fa fa"></i> Add</a></p>

function.php==

                   jQuery("#event-calendar").fullCalendar({
                    events:[<?php while( have_posts() ): the_post(); $total_posts++; ?>{
                                       //$project_title = get_post_meta( get_the_ID(), $mb->the_value(), true);
                        title: '<?php 
                                        $project_title = get_post_meta( get_the_ID(), '_elephas_meta_event_date' );
                                        if( (is_array( $project_title ) ) and ( !empty( $project_title[0]['project-title'] ) ) ){

                                              echo $project_title[0]['project-title'];
                                        }else{
                                              the_title();

                                       } ?>',
                        url: '<?php the_permalink(); ?>',

                                          start: '<?php echo elephas_format_event_date( elephas_event_dates( 'event_start', get_the_ID() ) ); ?>',
                    end: '<?php echo elephas_format_event_date( elephas_event_dates( 'event_end', get_the_ID() ) ); ?>',
                        className: new Array(<?php echo elephas_container_class_calendar( get_the_ID(), array( 'site', 'levels', 'main_project_icon' ) ); ?>),
                        //className: '<?php echo elephas_container_class( get_the_ID(), array( 'site', 'levels' ) ); ?>',

                    }

<?php if( $total_posts !== $post_count ):?>,<?php endif; ?><?php endwhile; ?>]});

            <?php endif; ?>