custom-facebook-feed
Last commit date
css
13 years ago
img
13 years ago
README.txt
13 years ago
custom-facebook-feed-admin.php
13 years ago
custom-facebook-feed.php
13 years ago
gpl-2.0.txt
13 years ago
custom-facebook-feed-admin.php
123 lines
| 1 | <?php |
| 2 | function cff_menu() { |
| 3 | add_menu_page('Settings', 'Custom Facebook Feed', 'manage_options', 'cff-top', 'cff_settings_page'); |
| 4 | } |
| 5 | add_action('admin_menu', 'cff_menu'); |
| 6 | |
| 7 | //Create Settings page |
| 8 | function cff_settings_page() { |
| 9 | |
| 10 | //Declare variables for fields |
| 11 | $hidden_field_name = 'cff_submit_hidden'; |
| 12 | $access_token = 'cff_access_token'; |
| 13 | $page_id = 'cff_page_id'; |
| 14 | $num_show = 'cff_num_show'; |
| 15 | |
| 16 | // Read in existing option value from database |
| 17 | $access_token_val = get_option( $access_token ); |
| 18 | $page_id_val = get_option( $page_id ); |
| 19 | $num_show_val = get_option( $num_show ); |
| 20 | |
| 21 | // See if the user has posted us some information. If they did, this hidden field will be set to 'Y'. |
| 22 | if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) { |
| 23 | // Read their posted value |
| 24 | $access_token_val = $_POST[ $access_token ]; |
| 25 | $page_id_val = $_POST[ $page_id ]; |
| 26 | $num_show_val = $_POST[ $num_show ]; |
| 27 | |
| 28 | // Save the posted value in the database |
| 29 | update_option( $access_token, $access_token_val ); |
| 30 | update_option( $page_id, $page_id_val ); |
| 31 | update_option( $num_show, $num_show_val ); |
| 32 | |
| 33 | // Put an settings updated message on the screen |
| 34 | ?> |
| 35 | <div class="updated"><p><strong><?php _e('Settings saved.', 'custom-facebook-feed' ); ?></strong></p></div> |
| 36 | |
| 37 | <?php } ?> |
| 38 | |
| 39 | <div class="wrap"> |
| 40 | |
| 41 | <h2><?php _e('Custom Facebook Feed'); ?></h2> |
| 42 | |
| 43 | <form name="form1" method="post" action=""> |
| 44 | |
| 45 | <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y"> |
| 46 | |
| 47 | |
| 48 | <h3><?php _e('Feed Settings'); ?></h3> |
| 49 | |
| 50 | |
| 51 | <table class="form-table"> |
| 52 | |
| 53 | <tbody> |
| 54 | |
| 55 | <tr valign="top"> |
| 56 | |
| 57 | <th scope="row"><?php _e('Access Token'); ?></th> |
| 58 | |
| 59 | <td> |
| 60 | |
| 61 | <input name="cff_access_token" type="text" value="<?php esc_attr_e( $access_token_val ); ?>" size="60" /> |
| 62 | |
| 63 | <a href="http://smashballoon.com/custom-facebook-feed/access-token/" target="_blank">How to get an Access Token</a> |
| 64 | |
| 65 | </td> |
| 66 | |
| 67 | </tr> |
| 68 | |
| 69 | <tr valign="top"> |
| 70 | |
| 71 | <th scope="row"><?php _e('Page ID'); ?></th> |
| 72 | |
| 73 | <td> |
| 74 | |
| 75 | <input name="cff_page_id" type="text" value="<?php esc_attr_e( $page_id_val ); ?>" size="60" /> |
| 76 | |
| 77 | <a href="http://smashballoon.com/custom-facebook-feed/faq/" target="_blank">What's my Page ID?</a> |
| 78 | |
| 79 | </td> |
| 80 | |
| 81 | </tr> |
| 82 | |
| 83 | <tr valign="top"> |
| 84 | |
| 85 | <th scope="row"><?php _e('Number of posts to display'); ?></th> |
| 86 | |
| 87 | <td> |
| 88 | |
| 89 | <input name="cff_num_show" type="text" value="<?php esc_attr_e( $num_show_val ); ?>" size="4" /> |
| 90 | |
| 91 | </td> |
| 92 | |
| 93 | </tr> |
| 94 | |
| 95 | </tbody> |
| 96 | |
| 97 | </table> |
| 98 | |
| 99 | <?php submit_button(); ?> |
| 100 | |
| 101 | |
| 102 | </form> |
| 103 | |
| 104 | <hr /> |
| 105 | |
| 106 | <h4>How to use</h4> |
| 107 | |
| 108 | <p>Copy and paste this shortcode directly into the page, post or widget where you'd like the feed to show up:</p> |
| 109 | |
| 110 | <input type="text" value="[custom-facebook-feed]" size="23" /> |
| 111 | |
| 112 | <p>You can override the Page ID and the number of posts directly in the shortcode like so:</p> |
| 113 | |
| 114 | <p>[custom-facebook-feed <b>id=Your_Page_ID show=3</b>]</p> |
| 115 | |
| 116 | <br /><br /><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank">Plugin Support</a> |
| 117 | |
| 118 | <br /><br /><br /> |
| 119 | <a href="http://smashballoon.com/custom-facebook-feed/" target="_blank"><img src="<?php echo plugins_url( 'img/pro.jpg' , __FILE__ ) ?>" /></a> |
| 120 | |
| 121 | <?php |
| 122 | } //End Settings_Page |
| 123 | ?> |