";
echo "\r\n";
}
}
if ( ! function_exists( 'asd_fld_insert_narrow' ) ) {
/** ----------------------------------------------------------------------------
* Function asd_fld_insert_narrow( $settingname )
* A shortcut function to create a narrower HTML input field based only on a
* setting name
* ----------------------------------------------------------------------------
*
* @param string $settingname - the name of the setting.
*/
function asd_fld_insert_narrow( $settingname ) {
echo ' ";
echo "\r\n";
}
}
if ( ! function_exists( 'asd_fastbuild_register_site_data_1_201808181' ) ) {
/** ----------------------------------------------------------------------------
* Function asd_fastbuild_admin_panel()
* adds the "Site Data" submenu to the top-level admin panel
* Hooks into the admin_menu action
* --------------------------------------------------------------------------*/
function asd_fastbuild_register_site_data_1_201808181() {
add_submenu_page(
'asd_settings',
'Site Data',
'Site Data',
'manage_options',
'asd_fastbuild',
'asd_fastbuild_options_1_201808181'
);
}
if ( is_admin() ) {
add_action( 'admin_menu', 'asd_fastbuild_register_site_data_1_201808181', 12 );
}
}
if ( ! function_exists( 'asd_fastbuild_options_1_201808181' ) ) {
/** ----------------------------------------------------------------------------
* Function asd_fastbuild_options()
* builds the Site Data Settings page, uses jquery-ui tabs
* --------------------------------------------------------------------------*/
function asd_fastbuild_options_1_201808181() {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( 'Insufficient Permissions' );
}
?>
Site Data Settings
The information in these fields is used in the ASD Fastbuild Widgets, and is also inserted into the page source as JSON-LD Structured Markup.
Check the
Google Structured Data Tool to verify this data is correctly interpreted for Search Engine Semantic Search, Rich Snippets, etc.
';
$asd_json_data = array();
$asd_json_data['@context'] = 'http://schema.org';
if ( get_option( 'asd_fastbuild_org_type' )['text_string'] ) {
$asd_json_data['@type'] = esc_attr( get_option( 'asd_fastbuild_org_type' )['text_string'] );
} else {
$asd_json_data['@type'] = 'Organization';
}
if ( get_option( 'asd_fastbuild_org' )['text_string'] ) {
$asd_json_data ['name'] = esc_attr( get_option( 'asd_fastbuild_org' )['text_string'] );
} else {
$asd_json_data ['name'] = esc_attr( get_bloginfo( 'name' ) );
}
if ( get_option( 'asd_fastbuild_org_legal' )['text_string'] ) {
$asd_json_data ['legalName'] = esc_attr( get_option( 'asd_fastbuild_org_legal' )['text_string'] );
}
if ( get_site_url() ) {
$asd_json_data['url'] = esc_url( get_site_url() );
}
if ( get_option( 'asd_fastbuild_org_logo' )['text_string'] ) {
$asd_json_data['logo'] = esc_url( get_option( 'asd_fastbuild_org_logo' )['text_string'] );
} else {
if ( get_theme_mod( 'custom_logo' ) ) {
$image = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' );
$asd_json_data['logo'] = esc_url( $image[0] );
}
}
if ( get_option( 'asd_fastbuild_org_image' )['text_string'] ) {
$asd_json_data['image'] = esc_url( get_option( 'asd_fastbuild_org_image' )['text_string'] );
}
if ( get_option( 'asd_fastbuild_org_desc' )['text_string'] ) {
$asd_json_data['description'] = esc_attr( get_option( 'asd_fastbuild_org_desc' )['text_string'] );
} else {
if ( get_bloginfo( 'description' ) ) {
$asd_json_data['description'] = esc_attr( get_bloginfo( 'description' ) );
}
}
if ( get_option( 'asd_fastbuild_org_pricerange' )['text_string'] ) {
$asd_json_data['priceRange'] = esc_attr( get_option( 'asd_fastbuild_org_pricerange' )['text_string'] );
}
if ( get_option( 'asd_fastbuild_phone1' )['text_string'] ) {
$asd_json_data['telephone'] = esc_attr( get_option( 'asd_fastbuild_phone1' )['text_string'] );
}
if ( get_option( 'asd_fastbuild_email_info' )['text_string'] ) {
$asd_json_data['email'] = esc_attr( get_option( 'asd_fastbuild_email_info' )['text_string'] );
}
$address = array();
$address['@type'] = 'PostalAddress';
if ( get_option( 'asd_fastbuild_addr_street1' )['text_string'] ) {
$address['streetAddress'] = esc_attr( get_option( 'asd_fastbuild_addr_street1' )['text_string'] );
}
if ( get_option( 'asd_fastbuild_addr_city' )['text_string'] ) {
$address['addressLocality'] = esc_attr( get_option( 'asd_fastbuild_addr_city' )['text_string'] );
}
if ( get_option( 'asd_fastbuild_addr_state' )['text_string'] ) {
$address['addressRegion'] = esc_attr( get_option( 'asd_fastbuild_addr_state' )['text_string'] );
}
if ( get_option( 'asd_fastbuild_addr_zip' )['text_string'] ) {
$address['postalCode'] = esc_attr( get_option( 'asd_fastbuild_addr_zip' )['text_string'] );
}
if ( get_option( 'asd_fastbuild_addr_country' )['text_string'] ) {
$address['addressCountry'] = esc_attr( get_option( 'asd_fastbuild_addr_country' )['text_string'] );
}
$asd_json_data['address'] = $address;
$hours = '';
if ( ! ( '' === get_option( 'asd_fastbuild_hours_mon_start1' )['text_string'] ) ||
( 'Closed' === get_option( 'asd_fastbuild_hours_mon_start1' )['text_string'] ) ) {
$hours = $hours . ' Mo ' . esc_attr( get_option( 'asd_fastbuild_hours_mon_start1' )['text_string'] ) . '-' .
esc_attr( get_option( 'asd_fastbuild_hours_mon_end1' )['text_string'] );
}
if ( ! ( '' === get_option( 'asd_fastbuild_hours_tue_start1' )['text_string'] ) ||
( 'Closed' === get_option( 'asd_fastbuild_hours_tue_start1' )['text_string'] ) ) {
$hours = $hours . ' Tu ' . esc_attr( get_option( 'asd_fastbuild_hours_tue_start1' )['text_string'] ) . '-' .
esc_attr( get_option( 'asd_fastbuild_hours_tue_end1' )['text_string'] );
}
if ( ! ( '' === get_option( 'asd_fastbuild_hours_wed_start1' )['text_string'] ) ||
( 'Closed' === get_option( 'asd_fastbuild_hours_wed_start1' )['text_string'] ) ) {
$hours = $hours . ' We ' . esc_attr( get_option( 'asd_fastbuild_hours_wed_start1' )['text_string'] ) . '-' .
esc_attr( get_option( 'asd_fastbuild_hours_wed_end1' )['text_string'] );
}
if ( ! ( '' === get_option( 'asd_fastbuild_hours_thu_start1' )['text_string'] ) ||
( 'Closed' === get_option( 'asd_fastbuild_hours_thu_start1' )['text_string'] ) ) {
$hours = $hours . ' Th ' . esc_attr( get_option( 'asd_fastbuild_hours_thu_start1' )['text_string'] ) . '-' .
esc_attr( get_option( 'asd_fastbuild_hours_thu_end1' )['text_string'] );
}
if ( ! ( '' === get_option( 'asd_fastbuild_hours_fri_start1' )['text_string'] ) ||
( 'Closed' === get_option( 'asd_fastbuild_hours_fri_start1' )['text_string'] ) ) {
$hours = $hours . ' Fr ' . esc_attr( get_option( 'asd_fastbuild_hours_fri_start1' )['text_string'] ) . '-' .
esc_attr( get_option( 'asd_fastbuild_hours_fri_end1' )['text_string'] );
}
if ( ! ( '' === get_option( 'asd_fastbuild_hours_sat_start1' )['text_string'] ) ||
( 'Closed' === get_option( 'asd_fastbuild_hours_sat_start1' )['text_string'] ) ) {
$hours = $hours . ' Sa ' . esc_attr( get_option( 'asd_fastbuild_hours_sat_start1' )['text_string'] ) . '-' .
esc_attr( get_option( 'asd_fastbuild_hours_sat_end1' )['text_string'] );
}
if ( ! ( '' === get_option( 'asd_fastbuild_hours_sun_start1' )['text_string'] ) ||
( 'Closed' === get_option( 'asd_fastbuild_hours_sun_start1' )['text_string'] ) ) {
$hours = $hours . ' Su ' . esc_attr( get_option( 'asd_fastbuild_hours_sun_start1' )['text_string'] ) . '-' .
esc_attr( get_option( 'asd_fastbuild_hours_sun_end1' )['text_string'] );
}
if ( '' !== $hours ) {
$asd_json_data['openingHours'] = $hours;
}
echo wp_json_encode( $asd_json_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES );
echo '';
}
}
add_action( 'wp_print_footer_scripts', 'asd_organization_json_1_201808181' );
}
}
}
if ( ! isset( $asd_register_site_data_version ) ) {
$asd_register_site_data_version = $this_asd_register_site_data_version;
setup_asd_register_site_data_functions_1_201808181();
} else {
if ( $this_asd_register_site_data_version > $asd_register_site_data_version ) {
unhook_asd_register_site_data_functions_1_201808181();
setup_asd_register_site_data_functions_1_201808181();
$asd_register_site_data_version = $this_asd_register_site_data_version;
}
}