field.php
2 years ago
form.php
2 years ago
list.php
2 years ago
single.php
2 years ago
view.php
2 years ago
single.php
103 lines
| 1 | <?php |
| 2 | // Don't load directly. |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | die( '-1' ); |
| 5 | } |
| 6 | ?> |
| 7 | <style type="text/css"> |
| 8 | ol.pods_single_widget_form { |
| 9 | list-style: none; |
| 10 | padding-left: 0; |
| 11 | margin-left: 0; |
| 12 | } |
| 13 | |
| 14 | ol.pods_single_widget_form label { |
| 15 | display: block; |
| 16 | } |
| 17 | </style> |
| 18 | |
| 19 | <p><em><?php _e('You must specify a Pods Template or create a custom template, using <a href="https://docs.pods.io/displaying-pods/magic-tags/using-magic-tags/" title="Using Magic Tags" target="_blank" rel="noopener noreferrer">magic tags</a>.', 'pods'); ?></p></em> |
| 20 | |
| 21 | <ol class="pods_single_widget_form"> |
| 22 | <li> |
| 23 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> <?php _e( 'Title', 'pods' ); ?></label> |
| 24 | |
| 25 | <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $title ); ?>" /> |
| 26 | </li> |
| 27 | |
| 28 | <li> |
| 29 | <?php |
| 30 | $api = pods_api(); |
| 31 | $all_pods = $api->load_pods( array( 'names' => true ) ); |
| 32 | ?> |
| 33 | <label for="<?php echo esc_attr( $this->get_field_id( 'pod_type' ) ); ?>"> |
| 34 | <?php _e( 'Pod', 'pods' ); ?> |
| 35 | </label> |
| 36 | |
| 37 | <?php if ( 0 < count( $all_pods ) ): ?> |
| 38 | <select id="<?php echo esc_attr( $this->get_field_id( 'pod_type' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'pod_type' ) ); ?>"> |
| 39 | <?php foreach ( $all_pods as $pod_name => $pod_label ): ?> |
| 40 | <option value="<?php echo esc_attr( $pod_name ); ?>"<?php selected( $pod_name, $pod_type ); ?>> |
| 41 | <?php echo esc_html( $pod_label . ' (' . $pod_name . ')' ); ?> |
| 42 | </option> |
| 43 | <?php endforeach; ?> |
| 44 | </select> |
| 45 | <?php else: ?> |
| 46 | <strong class="red"><?php _e( 'None Found', 'pods' ); ?></strong> |
| 47 | <?php endif; ?> |
| 48 | </li> |
| 49 | |
| 50 | <li> |
| 51 | <label for="<?php echo esc_attr( $this->get_field_id( 'slug' ) ); ?>"> |
| 52 | <?php _e( 'Slug or ID', 'pods' ); ?> |
| 53 | </label> |
| 54 | |
| 55 | <input class="widefat" type="text" id="<?php echo esc_attr( $this->get_field_id( 'slug' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'slug' ) ); ?>" value="<?php echo esc_attr( $slug ); ?>" /> |
| 56 | </li> |
| 57 | |
| 58 | <li> |
| 59 | <label for="<?php echo esc_attr( $this->get_field_id( 'use_current' ) ); ?>"> |
| 60 | <?php _e( 'Use current post (singular) or term (term archive)', 'pods' ); ?> |
| 61 | </label> |
| 62 | |
| 63 | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'use_current' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'use_current' ) ); ?>" value="1"<?php checked( $use_current, '1' ); ?> /> |
| 64 | </li> |
| 65 | |
| 66 | <?php |
| 67 | if ( class_exists( 'Pods_Templates' ) ) { |
| 68 | ?> |
| 69 | <li> |
| 70 | <?php |
| 71 | $all_templates = (array) $api->load_templates( array() ); |
| 72 | ?> |
| 73 | <label for="<?php echo esc_attr( $this->get_field_id( 'template' ) ); ?>"> <?php _e( 'Template', 'pods' ); ?> </label> |
| 74 | |
| 75 | <select name="<?php echo esc_attr( $this->get_field_name( 'template' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'template' ) ); ?>"> |
| 76 | <option value="">- <?php _e( 'Custom Template', 'pods' ); ?> -</option> |
| 77 | <?php foreach ( $all_templates as $tpl ): ?> |
| 78 | <option value="<?php echo esc_attr( $tpl[ 'name' ] ); ?>"<?php selected( $tpl[ 'name' ], $template ); ?>> |
| 79 | <?php echo esc_html( $tpl[ 'name' ] ); ?> |
| 80 | </option> |
| 81 | <?php endforeach; ?> |
| 82 | </select> |
| 83 | </li> |
| 84 | <?php |
| 85 | } |
| 86 | else { |
| 87 | ?> |
| 88 | <li> |
| 89 | <label for="<?php echo esc_attr( $this->get_field_id( 'template' ) ); ?>"> <?php _e( 'Template', 'pods' ); ?> </label> |
| 90 | |
| 91 | <input class="widefat" type="text" id="<?php echo esc_attr( $this->get_field_id( 'template' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'template' ) ); ?>" value="<?php echo esc_attr( $template ); ?>" /> |
| 92 | </li> |
| 93 | <?php |
| 94 | } |
| 95 | ?> |
| 96 | |
| 97 | <li> |
| 98 | <label for="<?php echo esc_attr( $this->get_field_id( 'template_custom' ) ); ?>"> <?php _e( 'Custom Template', 'pods' ); ?> </label> |
| 99 | |
| 100 | <textarea name="<?php echo esc_attr( $this->get_field_name( 'template_custom' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'template_custom' ) ); ?>" cols="10" rows="10" class="widefat"><?php echo esc_html( $template_custom ); ?></textarea> |
| 101 | </li> |
| 102 | </ol> |
| 103 |