WS_OK_7.4.33 HEX
HEX
Server: nginx/1.21.4
System: Linux v12674 6.8.0-85-generic #85-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 18 15:26:59 UTC 2025 x86_64
User: endtheignorance (1014)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v12674/lcanorthpittsburgh/public_html/wp-content/themes/lcoa-child/functions.php
<?php

/*
* Add your own functions here. You can also copy some of the theme functions into this file. 
* Wordpress will use those functions instead of the original functions then.
*/

/* Jim Hinman Location Data WP Admin Section for LCOA */
function lcoa_location_page(){
	 ?>
	    <div class="wrap">
	    <form method="post" action="options.php">
	        <?php
	            settings_fields("section");
	            do_settings_sections("lcoa-location");      
	            submit_button(); 
	        ?>          
	    </form>
		</div>
	<?php
}

function display_address_element()
{
	?>
    	<input type="text" name="lcoa_address" id="lcoa_address" value="<?php echo get_option('lcoa_address'); ?>" />
    <?php
}

function display_address_2_element()
{
	?>
    	<input type="text" name="lcoa_address_2" id="lcoa_address_2" value="<?php echo get_option('lcoa_address_2'); ?>" />
    <?php
}

function display_city_element()
{
	?>
    	<input type="text" name="lcoa_city" id="lcoa_city" value="<?php echo get_option('lcoa_city'); ?>" />
    <?php
}

function display_state_element()
{
	?>
    	<input type="text" name="lcoa_state" id="lcoa_state" value="<?php echo get_option('lcoa_state'); ?>" />
    <?php
}

function display_zip_element()
{
	?>
    	<input type="text" name="lcoa_zip" id="lcoa_zip" value="<?php echo get_option('lcoa_zip'); ?>" />
    <?php
}

function display_phone_element()
{
	?>
    	<input type="text" name="lcoa_phone" id="lcoa_phone" value="<?php echo get_option('lcoa_phone'); ?>" />
    <?php
}
function display_email_element()
{
	?>
    	<input type="text" name="lcoa_email" id="lcoa_email" value="<?php echo get_option('lcoa_email'); ?>" />
    <?php
}

function display_map_element()
{
	?>
    	<input type="text" name="lcoa_map" id="lcoa_map" value="<?php echo get_option('lcoa_map'); ?>" />
    <?php
}

function display_lcoa_panel_fields()
{
	
	add_settings_section("section", "LCAO Clinic NAP", null, "lcoa-location");
    
    //address
    add_settings_field("lcoa_address", "LCOA Address", "display_address_element", "lcoa-location", "section");
    register_setting("section", "lcoa_address");
 	
 	//Address 2
    add_settings_field("lcoa_address_2", "LCOA Address 2", "display_address_2_element", "lcoa-location", "section");
    register_setting("section", "lcoa_address_2");
   
     //city
    add_settings_field("lcoa_city", "LCOA City", "display_city_element", "lcoa-location", "section");
    register_setting("section", "lcoa_city");

       //State
    add_settings_field("lcoa_state", "LCOA State", "display_state_element", "lcoa-location", "section");
    register_setting("section", "lcoa_state");

       //Zip
    add_settings_field("lcoa_zip", "LCOA Zip", "display_zip_element", "lcoa-location", "section");
    register_setting("section", "lcoa_zip");

       //phone
    add_settings_field("lcoa_phone", "LCOA Phone", "display_phone_element", "lcoa-location", "section");
    register_setting("section", "lcoa_phone");

    //email
    add_settings_field("lcoa_email", "LCOA Email", "display_email_element", "lcoa-location", "section");
    register_setting("section", "lcoa_email");

     //map
    add_settings_field("lcoa_map", "LCOA MAP", "display_map_element", "lcoa-location", "section");
    register_setting("section", "lcoa_map");

}

add_action("admin_init", "display_lcoa_panel_fields");

function add_lcoa_admin_item()
{
	add_menu_page("Clinic Location", "Clinic Location", "manage_options", "functions", "lcoa_location_page", null, 99);
}
add_action("admin_menu", "add_lcoa_admin_item");



/**
 * [lcoa-phone] Shortcode
 * 
 * Returns Click to Call Phone
 *
 */
function lcoa_phone_shortcode() {
	$lcoa_phone = get_option('lcoa_phone');
	$output = "<a href='tel:+1".$lcoa_phone."' onclick=\"ga('send', 'event', 'Contact', 'Click to Call', 'ShortCode');\">".$lcoa_phone."</a>";
	return $output;
}

/**
 * [lcoa-map] Shortcode
 * 
 * Returns Click to Call Phone
 *
 */
function lcoa_map_shortcode() {
	$lcoa_map = get_option('lcoa_map');
	$output = "<a href='".$lcoa_map."' target='_blank' onclick=\"ga('send', 'event', 'Directions', 'Click to Map', 'ShortCode');\">Click Here For Map</a>";
	return $output;
}

/**
 * [lcoa-address] Shortcode
 * 
 * Returns address string
 *
 */
function lcoa_address_shortcode() {
	$lcoa_address = get_option('lcoa_address');
	$lcoa_address_2 = get_option('lcoa_address_2');
	$lcoa_city = get_option('lcoa_city');
	$lcoa_state = get_option('lcoa_state');
	$lcoa_zip = get_option('lcoa_zip');

	$output = $lcoa_address."&nbsp;".$lcoa_address_2."</br>".$lcoa_city.",&nbsp".$lcoa_state."&nbsp".$lcoa_zip;
	return $output;
}

/**
 * [lcoa-email] Shortcode
 * 
 * Returns click to email
 *
 */
function lcoa_email_shortcode() {
	$lcoa_email = get_option('lcoa_email');
	$output = "<a href='mailto:$lcoa_email'>".$lcoa_email."</a>";
	return $output;
}

/**
 * [lcoa-city] Shortcode
 * 
 * Returns City Name
 *
 */
function lcoa_city_shortcode() {
	$lcoa_city = get_option('lcoa_city');
	$output = $lcoa_city;
	return $output;
}

/**
 * [lcoa-state] Shortcode
 * 
 * Returns State Name
 *
 */
function lcoa_state_shortcode() {
	$lcoa_state = get_option('lcoa_state');
	$output = $lcoa_state;
	return $output;
}


add_shortcode( 'lcoa-phone', 'lcoa_phone_shortcode' );
add_shortcode( 'lcoa-address', 'lcoa_address_shortcode' );
add_shortcode( 'lcoa-email', 'lcoa_email_shortcode' );
add_shortcode( 'lcoa-city', 'lcoa_city_shortcode' );
add_shortcode( 'lcoa-state', 'lcoa_state_shortcode' );
add_shortcode( 'lcoa-map', 'lcoa_map_shortcode' );

add_filter( 'widget_text', 'shortcode_unautop');
add_filter( 'widget_text', 'do_shortcode');