Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bahiirwa/a6ad98fa4f03fb20748fbe1a21d3f3b4 to your computer and use it in GitHub Desktop.
Save bahiirwa/a6ad98fa4f03fb20748fbe1a21d3f3b4 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: Techie Options
* Plugin URI: https://github.com/yttechiepress/techie-options-page
* Author: Techiepress
* Author URI: https://github.com/yttechiepress/techie-options-page
* Description: This plugin adds an ACF Options Page to WP.
* Version: 0.1.0
* License: GPL2
* License URL: http://www.gnu.org/licenses/gpl-2.0.txt
* text-domain: techie-options-page
*/
// Basic security.
defined( 'ABSPATH' ) or die( 'Unauthorized Access' );
if ( function_exists( 'acf_add_options_page' ) ) {
// Add a top menu page
acf_add_options_page(
array(
'page_title' => 'Footer Options Page',
'menu_title' => 'Footer Options',
'menu_slug' => 'techie-options',
'redirect' => false,
'capability' => 'administrator',
'position' => 5.4
)
);
// Add a Sub Page
acf_add_options_sub_page(
array(
'page_title' => 'Sub Footer Options Page',
'menu_title' => 'Sub Footer Options',
'parent_slug' => 'techie-options',
)
);
}
// Save the ACF fields in the plugin.
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_6119db99a4fb1',
'title' => 'Footer Settings',
'fields' => array(
array(
'key' => 'field_6119dba3720c0',
'label' => 'Holding Company',
'name' => 'holding_company',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
),
'location' => array(
array(
array(
'param' => 'options_page',
'operator' => '==',
'value' => 'techie-options',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
));
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment