Changeset 2100496
- Timestamp:
- 06/04/2019 03:19:41 PM (7 years ago)
- Location:
- post-thanks/trunk
- Files:
-
- 2 edited
-
postthankyou.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
post-thanks/trunk/postthankyou.php
r2087796 r2100496 17 17 */ 18 18 19 add_action('admin_menu', 'p_my_thank_you_menu'); 20 21 function p_my_thank_you_menu() { 22 add_menu_page(__('p_my_thank_you_form', 'thank-you'), __('Post Thank You', 'thank-you'), 'manage_options', 'p_my_thank_you_form', 'p_my_thank_you_form'); 23 } 24 25 function p_my_thank_you_form() { 26 27 echo ' 28 <br> 29 <br> 30 <br> 31 <div class="container"> 32 <h2>Post Thank You ---- Menu</h2> 33 <form action="' . $_SERVER['REQUEST_URI'] . '" method="post"> 34 <p>Display or Hide text:</p> 35 <div class="radio"> 36 <label><input type="radio" name="displayhide" value="block" checked>Display text</label> 37 </div> 38 <div class="radio"> 39 <label><input type="radio" name="displayhide" value="none">Hide text</label> 40 </div> 41 <br> 42 <br> 43 <div> 44 <p>Enter your text here:</p> 45 <textarea name="text">' . ( isset( $_POST['text']) ? $text : null ) . '</textarea> 46 </div> 47 <br> 48 <br> 49 <div> 50 <p>Select text color:</p> 51 <input type ="text" name="textcolor">' . ( isset( $_POST['textcolor']) ? $textcolor : null ) . ' 52 </div> 53 <br> 54 <br> 55 <br> 56 <input type="submit" name="submit" value="Submit"/> 57 </form> 58 </div> 59 '; 60 61 if (!isset($_POST['text'])) { 62 echo '<br><br>Please enter a custom text to update in all posts.'; 63 exit; 64 } else { 65 $text = esc_textarea($_POST['text']); 66 add_option( 'post_thanks_text', $text ); 67 update_option( 'post_thanks_text', $text ); 68 } 69 70 $textcolor = $_POST["textcolor"]; 71 add_option( 'post_thanks_text_color', $textcolor ); 72 update_option( 'post_thanks_text_color', $textcolor ); 73 74 $showhide = $_POST["displayhide"]; 75 add_option( 'post_thanks_text_displayhide', $showhide ); 76 update_option( 'post_thanks_text_displayhide', $showhide ); 77 } 78 19 79 add_action( 'the_content', 'p_my_thank_you_text' ); 20 80 21 function p_my_thank_you_text ( $content ) { 22 return $content .= '<p>Thank you for reading!</p>'; 81 function p_my_thank_you_text ($content) { 82 $post_thanks_text = get_option( 'post_thanks_text' ); 83 $post_thanks_text_color = get_option( 'post_thanks_text_color' ); 84 $post_thanks_text_showhide = get_option( 'post_thanks_text_displayhide' ); 85 86 if($post_thanks_text == ''){ 87 return $content .= '<div style = "color: '.$post_thanks_text_color.'; display: '.$post_thanks_text_showhide.';" class="post_thanks">Thank you for reading!</div>'; 88 } 89 else { 90 return $content .= '<div style = "color: '.$post_thanks_text_color.'; display: '.$post_thanks_text_showhide.';" class="post_thanks">'.$post_thanks_text.'</div>'; 91 } 23 92 } 93 //Pending display: block or none not working yet. Color style code working. -
post-thanks/trunk/readme.txt
r2094046 r2100496 26 26 == Upgrade Notice == 27 27 28 No need to upgrade yet. We will add functionality to automatically add particular text through a text box later.28 We are upgrading the plugin. 29 29 30 30 == Version == 31 1.0.0 31 32 =1.1= 33 * Added functionality to show hide text 34 * Added functionality to manually enter text 35 * Added functionality to color text 36 37 =1.0= 38 First version
Note: See TracChangeset
for help on using the changeset viewer.