"facebook_settings", 'icon' => "facebook-square", 'title' => __("Facebook", 'allfacebook-instant-articles'), 'page' => "afbia_settings_page", 'description' => __("Settings that require input from Facebook.", 'allfacebook-instant-articles'), ); $facebook_settings = new afbia_settings_section($args); $args = array( 'id' => 'afbia_page_id', 'title' => __("Page ID", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'facebook_settings', 'description' => __("The page ID of the facebook page you want to add Instant Articles to.", 'allfacebook-instant-articles'), 'type' => 'text', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_page_id = new afbia_settings_field($args); // // Feed Settings // $args = array( 'id' => "feed_settings", 'icon' => "feed", 'title' => __("Feed", 'allfacebook-instant-articles'), 'page' => "afbia_settings_page", 'description' => __("Settings that modify parts of the Instant Articles feed.", 'allfacebook-instant-articles'), ); $facebook_settings = new afbia_settings_section($args); $args = array( 'id' => 'afbia_copyright', 'title' => __("Copyright", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("The standard copyright details for your instant articles.", 'allfacebook-instant-articles'), 'type' => 'textarea', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_copyright = new afbia_settings_field($args); $args = array( 'id' => 'afbia_like_media', 'title' => __("Like Media", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("Allow users to like the media you embedded.", 'allfacebook-instant-articles'), 'type' => 'checkbox', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_like_media = new afbia_settings_field($args); $args = array( 'id' => 'afbia_comment_media', 'title' => __("Comment Media", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("Allow users to comment on the media you embedded.", 'allfacebook-instant-articles'), 'type' => 'checkbox', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_comment_media = new afbia_settings_field($args); $args = array( 'id' => 'afbia_article_interaction', 'title' => __("Article Interaction", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("Allow users to like and comment the whole article.", 'allfacebook-instant-articles'), 'type' => 'checkbox', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_article_interaction = new afbia_settings_field($args); $args = array( 'id' => 'afbia_rtl_publishing', 'title' => __("RTL Publishing", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("Allows Right to Left Publishing for Arabic, Hebrew, Persian and other languages", 'allfacebook-instant-articles'), 'type' => 'checkbox', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_comment_media = new afbia_settings_field($args); $args = array( 'id' => 'afbia_articles_num', 'title' => __("Number of Articles", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("The number of articles, that will be rendered on the feed.", 'allfacebook-instant-articles'), 'type' => 'text', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_comment_media = new afbia_settings_field($args); $args = array( 'id' => 'afbia_articles_style', 'title' => __("Style of Articles", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("Style for articles if different from default", 'allfacebook-instant-articles'), 'type' => 'text', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_comment_media = new afbia_settings_field($args); // // Tracking Settings // $args = array( 'id' => "tracking_settings", 'icon' => "line-chart", 'title' => __("Tracking & Analytics", 'allfacebook-instant-articles'), 'page' => "afbia_settings_page", 'description' => __("Settings that set how you want to track your content.", 'allfacebook-instant-articles'), ); $facebook_settings = new afbia_settings_section($args); $args = array( 'id' => 'afbia_tracking', 'title' => __("Tracking Code", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'tracking_settings', 'description' => __("The tracking code, that will be embedded in your instant articles. See this link for more information.", 'allfacebook-instant-articles'), 'type' => 'textarea', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_tracking = new afbia_settings_field($args); $args = array( 'id' => 'afbia_ga_uid', 'title' => __("Google Tracking ID", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'tracking_settings', 'description' => __("If you want us to generate a Google Analytics tracking code for you, enter your analytics tracking ID here. (e.g. UA-XXXXX-Y)", 'allfacebook-instant-articles'), 'placeholder' => __("UA-XXXXX-Y", 'allfacebook-instant-articles'), 'type' => 'text', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_tracking = new afbia_settings_field($args); $args = array( 'id' => 'afbia_ga_anonymize_ip', 'title' => __("Anonymize IP", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'tracking_settings', 'description' => __("For many countries it is advisable to activate IP anonymization, to be compliant with data protection laws. More about that here.", 'allfacebook-instant-articles'), 'type' => 'checkbox', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_tracking = new afbia_settings_field($args); // // Ad Settings Version 2 // Added in 0.8.3 // $args = array( 'id' => "afbia_ad_settings_2", 'icon' => "money", 'title' => __("Ads", 'allfacebook-instant-articles'), 'page' => "afbia_settings_page", 'description' => __("Facebook Audience Network for Instant Articles ", 'allfacebook-instant-articles'), ); new afbia_settings_section($args); $args = array( 'id' => 'afbia_audience_active', // TODO: Change and migrate the ID name to something, that makes more sense 'title' => __("Automatic Placement", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'afbia_ad_settings_2', 'description' => __("Activate automatic placement of ads for Instant Articles.", 'allfacebook-instant-articles'), 'type' => 'checkbox', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); new afbia_settings_field($args); $args = array( 'id' => 'afbia_audienceplacement', 'title' => __("Placement IDs", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'afbia_ad_settings_2', 'description' => __("Audience Network Placement IDs ", 'allfacebook-instant-articles'), 'type' => 'text', // text, textarea, password, checkbox 'multi' => true, 'option_group' => "settings_page_afbia_settings_page", ); new afbia_settings_field($args); // // Custom Ads // Added in 0.8.3 // $args = array( 'id' => 'afbia_customads', 'title' => __("Direct-Sold Ads", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'afbia_ad_settings_2', 'description' => __("The source code of the custom ads, that will be placed in the Instant Article. ", 'allfacebook-instant-articles'), 'type' => 'text', // text, textarea, password, checkbox 'placeholder' => __('', 'allfacebook-instant-articles'), 'multi' => true, 'option_group' => "settings_page_afbia_settings_page", ); new afbia_settings_field($args); // // Help Page // /* $args = array( 'id' => "help_page", 'icon' => "question-circle", 'title' => __("Help", 'allfacebook-instant-articles'), 'page' => "afbia_settings_page", 'description' => __("One day this will be a proper help page.", 'allfacebook-instant-articles'), ); $help_page = new afbia_settings_section($args); /**/ } // // Register the Theme Settings Page // /** * add_theme_settings_page function. * * @access public * @return void */ public function add_theme_settings_page(){ $theme_page = add_options_page( __("Instant Articles", 'allfacebook-instant-articles'), __("Instant Articles", 'allfacebook-instant-articles'), 'manage_options', 'afbia_settings_page', array($this, 'lh_settings_page_v2') ); } /** * lh_settings_page function. * * @access public * @return void */ public function lh_settings_page(){ ?>

"instant_articles"), trailingslashit(get_home_url())); ?>" class="button-primary" target="_blank">

allfacebook.de Instant Articles", 'allfacebook-instant-articles'); ?> "instant_articles"), trailingslashit(get_home_url())); ?>" class="page-title-action" target="_blank">

'; if ( $section['icon'] ) { $icon = ""; } else { $icon = null; } if ( $section['title'] ) echo "

$icon {$section['title']}

\n"; if ( $section['callback'] ) call_user_func( $section['callback'], $section ); do_action("afb_settings_section_" . $section['id']); if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) ) { echo '
'; continue; } echo ''; do_settings_fields( $page, $section['id'] ); echo '
'; echo '

'; echo '
'; } } ?>
- in Munich by Luehrsen // Heinrich and many GitHub contributors', 'allfacebook-instant-articles'); ?>
This is the preparation of a proper help page. NULL, 'title' => NULL, 'page' => NULL, 'description' => NULL, 'icon' => NULL, ); $args = wp_parse_args( $args, $defaults ); $this->args = $args; $this->register_section(); } /** * register_section function. * * @access private * @param mixed $args * @return void */ private function register_section(){ global $wp_settings_sections; $wp_settings_sections[$this->args['page']][$this->args['id']] = array('id' => $this->args['id'], 'title' => $this->args['title'], 'callback' => array($this, 'output_callback'), 'icon' => $this->args['icon']); } /** * output_callback function. * * @access public * @return void */ public function output_callback(){ ?>

args['description'] ?>

NULL, 'title' => NULL, 'page' => NULL, 'section' => NULL, 'description' => NULL, 'type' => 'text', // text, textarea, password, checkbox 'multi' => false, 'placeholder' => NULL, 'sanitize_callback' => NULL, 'option_group' => NULL, ); $this->args = wp_parse_args( $args, $defaults ); $this->register_field(); } /** * register_field function. * * @access private * @return void */ private function register_field(){ add_settings_field( $this->args['id'], '', array($this, 'output_callback'), $this->args['page'], $this->args['section'] ); register_setting($this->args['option_group'], $this->args['id'], isset($this->args['sanatize_callback']) ? $this->args['sanatize_callback'] : NULL ); } /** * output_callback function. * * @access public * @return void */ public function output_callback(){ $t = $this->args['type']; if($t == "text"): $classes = array("text"); if($this->args['multi']){ $classes[] = "multi"; } ?>
"> args['multi']): // Show multiple instances of this setting, save in array foreach(array_filter((array) get_option($this->args['id'])) as $value): ?>

args['description']; ?>

args['description']; ?>

args['description']; ?>

$this->args['id'], "id" => $this->args['id'], "selected" => get_option($this->args['id']), "show_option_none" => __("Not selected", 'allfacebook-instant-articles'), ); wp_dropdown_categories( $args ); ?>

args['description']; ?>

args['callback'], $this->args); endif; } }