PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.6
Pods – Custom Content Types and Fields v3.3.6
trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / ui / admin / widgets / single.php
pods / ui / admin / widgets Last commit date
field.php 4 months ago form.php 4 months ago list.php 4 months ago single.php 4 months ago view.php 4 months ago
single.php
106 lines
1 <?php
2
3 // Don't load directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 die( '-1' );
6 }
7
8 // phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
9 ?>
10 <style type="text/css">
11 ol.pods_single_widget_form {
12 list-style: none;
13 padding-left: 0;
14 margin-left: 0;
15 }
16
17 ol.pods_single_widget_form label {
18 display: block;
19 }
20 </style>
21
22 <p><em><?php echo wp_kses_post( __( '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>
23
24 <ol class="pods_single_widget_form">
25 <li>
26 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'pods' ); ?></label>
27
28 <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 ); ?>" />
29 </li>
30
31 <li>
32 <?php
33 $api = pods_api();
34 $all_pods = $api->load_pods( array( 'names' => true ) );
35 ?>
36 <label for="<?php echo esc_attr( $this->get_field_id( 'pod_type' ) ); ?>">
37 <?php esc_html_e( 'Pod', 'pods' ); ?>
38 </label>
39
40 <?php if ( 0 < count( $all_pods ) ): ?>
41 <select id="<?php echo esc_attr( $this->get_field_id( 'pod_type' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'pod_type' ) ); ?>">
42 <?php foreach ( $all_pods as $pod_name => $pod_label ): ?>
43 <option value="<?php echo esc_attr( $pod_name ); ?>"<?php selected( $pod_name, $pod_type ); ?>>
44 <?php echo esc_html( $pod_label . ' (' . $pod_name . ')' ); ?>
45 </option>
46 <?php endforeach; ?>
47 </select>
48 <?php else: ?>
49 <strong class="red"><?php esc_html_e( 'None Found', 'pods' ); ?></strong>
50 <?php endif; ?>
51 </li>
52
53 <li>
54 <label for="<?php echo esc_attr( $this->get_field_id( 'slug' ) ); ?>">
55 <?php esc_html_e( 'Slug or ID', 'pods' ); ?>
56 </label>
57
58 <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 ); ?>" />
59 </li>
60
61 <li>
62 <label for="<?php echo esc_attr( $this->get_field_id( 'use_current' ) ); ?>">
63 <?php esc_html_e( 'Use current post (singular) or term (term archive)', 'pods' ); ?>
64 </label>
65
66 <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' ); ?> />
67 </li>
68
69 <?php
70 if ( class_exists( 'Pods_Templates' ) ) {
71 ?>
72 <li>
73 <?php
74 $all_templates = (array) $api->load_templates( array() );
75 ?>
76 <label for="<?php echo esc_attr( $this->get_field_id( 'template' ) ); ?>"><?php esc_html_e( 'Template', 'pods' ); ?> </label>
77
78 <select name="<?php echo esc_attr( $this->get_field_name( 'template' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'template' ) ); ?>">
79 <option value="">- <?php esc_html_e( 'Custom Template', 'pods' ); ?> -</option>
80 <?php foreach ( $all_templates as $tpl ): ?>
81 <option value="<?php echo esc_attr( $tpl[ 'name' ] ); ?>"<?php selected( $tpl[ 'name' ], $template ); ?>>
82 <?php echo esc_html( $tpl[ 'name' ] ); ?>
83 </option>
84 <?php endforeach; ?>
85 </select>
86 </li>
87 <?php
88 }
89 else {
90 ?>
91 <li>
92 <label for="<?php echo esc_attr( $this->get_field_id( 'template' ) ); ?>"><?php esc_html_e( 'Template', 'pods' ); ?> </label>
93
94 <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 ); ?>" />
95 </li>
96 <?php
97 }
98 ?>
99
100 <li>
101 <label for="<?php echo esc_attr( $this->get_field_id( 'template_custom' ) ); ?>"><?php esc_html_e( 'Custom Template', 'pods' ); ?> </label>
102
103 <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>
104 </li>
105 </ol>
106