Skip to content

Commit 171f055

Browse files
committed
Form Styling Updated
- basic styling and quality of life updates - default select Uncategorized for Category - re-order form inputs - change image description to input from textarea - display form inside "card" (lifted from another WordPress form screen)
1 parent ced8a78 commit 171f055

File tree

1 file changed

+66
-48
lines changed

1 file changed

+66
-48
lines changed

quick-weblog.php

Lines changed: 66 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,58 +17,76 @@ function quick_weblog_form() {
1717
?>
1818
<style>
1919
#quick-weblog {
20-
background-color: red;
21-
padding: 20px;
20+
padding: 1em 0;
2221
}
2322
#quick-weblog div {
24-
border: 2px solid yellow;
25-
background-color: lightblue;
26-
padding: 20px;
23+
padding: 0.75em 0;
24+
}
25+
#quick-weblog div:nth-last-child(1) {
26+
padding-bottom: 0;
27+
}
28+
#quick-weblog div:nth-child(1) {
29+
padding-top: 0;
30+
}
31+
#quick-weblog div label {
32+
font-weight: 600;
33+
}
34+
#quick-weblog div input,
35+
#quick-weblog div textarea,
36+
#quick-weblog div select {
37+
display: block;
38+
max-width: 600px;
39+
width: 99%;
40+
}
41+
#quick-weblog div input[type=submit] {
42+
width: auto;
2743
}
2844
</style>
29-
30-
<form id="quick-weblog" method="post" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>">
31-
<div>
32-
<label for="title"><?php _e( 'Title', 'quick-weblog' ); ?></label>
33-
<input type="text" name="title" id="title" required>
34-
</div>
35-
36-
<div>
37-
<label for="image_url"><?php _e( 'Image URL', 'quick-weblog' ); ?></label>
38-
<input type="text" name="image_url" id="image_url" required>
39-
</div>
40-
41-
<div>
42-
<label for="image_description"><?php _e( 'Image Description', 'quick-weblog' ); ?></label>
43-
<textarea name="image_description" id="image_description" required></textarea>
44-
</div>
45-
46-
<div>
47-
<label for="quote"><?php _e( 'Quote', 'quick-weblog' ); ?></label>
48-
<textarea name="quote" id="quote" required></textarea>
49-
</div>
50-
51-
<div>
52-
<label for="url"><?php _e( 'URL', 'quick-weblog' ); ?></label>
53-
<input type="text" name="url" id="url" required>
54-
</div>
55-
56-
<div>
57-
<label for="category"><?php _e( 'Category', 'quick-weblog' ); ?></label>
58-
<?php wp_dropdown_categories( array( 'name' => 'category', 'orderby' => 'name', 'taxonomy' => 'category' ) ); ?>
59-
</div>
60-
61-
<div>
62-
<label for="tags"><?php _e( 'Tags', 'quick-weblog' ); ?></label>
63-
<input type="text" name="tags" id="tags" required>
64-
</div>
65-
66-
<div>
67-
<input type="hidden" name="action" value="quick_weblog_submit_form">
68-
<?php wp_nonce_field( 'quick_weblog_submit_form', 'quick_weblog_form_nonce' ); ?>
69-
<input type="submit" value="<?php _e( 'Submit', 'quick-weblog' ); ?>">
70-
</div>
71-
</form>
45+
46+
<div class="card">
47+
<form id="quick-weblog" method="post" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>">
48+
<div>
49+
<label for="url"><?php _e( 'Post URL', 'quick-weblog' ); ?></label>
50+
<input type="text" name="url" id="url" required>
51+
</div>
52+
53+
<div>
54+
<label for="title"><?php _e( 'Post Title', 'quick-weblog' ); ?></label>
55+
<input type="text" name="title" id="title" required>
56+
</div>
57+
58+
<div>
59+
<label for="image_url"><?php _e( 'Image URL', 'quick-weblog' ); ?></label>
60+
<input type="text" name="image_url" id="image_url" required>
61+
</div>
62+
63+
<div>
64+
<label for="image_description"><?php _e( 'Image Description', 'quick-weblog' ); ?></label>
65+
<input type="text" name="image_description" id="image_description" required>
66+
</div>
67+
68+
<div>
69+
<label for="quote"><?php _e( 'Quote', 'quick-weblog' ); ?></label>
70+
<textarea name="quote" id="quote" rows="6" required></textarea>
71+
</div>
72+
73+
<div>
74+
<label for="category"><?php _e( 'Category', 'quick-weblog' ); ?></label>
75+
<?php wp_dropdown_categories( array( 'name' => 'category', 'orderby' => 'name', 'taxonomy' => 'category', 'selected' => 1) ); ?>
76+
</div>
77+
78+
<div>
79+
<label for="tags"><?php _e( 'Tags', 'quick-weblog' ); ?></label>
80+
<input type="text" name="tags" id="tags" required>
81+
</div>
82+
83+
<div>
84+
<input type="hidden" name="action" value="quick_weblog_submit_form">
85+
<?php wp_nonce_field( 'quick_weblog_submit_form', 'quick_weblog_form_nonce' ); ?>
86+
<input type="submit" value="<?php _e( 'Submit', 'quick-weblog' ); ?>">
87+
</div>
88+
</form>
89+
</div>
7290
<?php
7391
}
7492

0 commit comments

Comments
 (0)