changed orgization
This commit is contained in:
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
function add_opengraph_tags() {
|
||||
$author_id = get_option('sophia_after_dark_home_og_user', 1); // Default to user ID 1 if not set
|
||||
|
||||
$author_bio = get_the_author_meta('description', $author_id);
|
||||
|
||||
if (is_front_page()) {
|
||||
$home_og_image = get_option('sophia_after_dark_home_og_image');
|
||||
if ($home_og_image) {
|
||||
echo '<meta property="og:image" content="' . esc_url($home_og_image) . '" />';
|
||||
}
|
||||
echo '<meta property="og:title" content="' . esc_attr(get_bloginfo('name') . ' - ' . get_bloginfo('description')) . '" />';
|
||||
echo '<meta property="og:description" content="' . esc_attr($author_bio) . '" />';
|
||||
echo '<meta property="og:url" content="' . esc_url(home_url('/')) . '" />';
|
||||
} elseif (is_single() || is_page()) {
|
||||
global $post;
|
||||
if (has_post_thumbnail($post->ID)) {
|
||||
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'og-image-size');
|
||||
if ($thumbnail) {
|
||||
echo '<meta property="og:image" content="' . esc_url($thumbnail[0]) . '" />';
|
||||
|
||||
//$thumbnail_url = esc_url($thumbnail[0]);
|
||||
//$thumbnail_parts = pathinfo($thumbnail_url);
|
||||
//$thumbnail_new_url = $thumbnail_parts['dirname'] . '/' . $thumbnail_parts['filename'] . '-1536x878.' . $thumbnail_parts['extension'];
|
||||
//echo '<meta property="og:image" content="' . $thumbnail_new_url . '" />';
|
||||
}
|
||||
} else {
|
||||
echo '<meta property="og:image" content="' . esc_url(get_template_directory_uri() . '/assets/images/default-og-image.webp') . '" />';
|
||||
}
|
||||
echo '<meta property="og:title" content="' . esc_attr(get_the_title()) . '" />';
|
||||
echo '<meta property="og:description" content="' . esc_attr(get_the_excerpt()) . '" />';
|
||||
echo '<meta property="og:url" content="' . esc_url(get_permalink()) . '" />';
|
||||
}
|
||||
}
|
||||
add_action('wp_head', 'add_opengraph_tags');
|
@ -26,29 +26,6 @@ function sophia_after_dark_customize_general_panels_sections_register( $wp_custo
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Toggle field for Enable/Disable preloader.
|
||||
*
|
||||
*/
|
||||
$wp_customize->add_setting( 'sophia_after_dark_enable_preloader',
|
||||
array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'default' => true,
|
||||
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
|
||||
$wp_customize, 'sophia_after_dark_enable_preloader',
|
||||
array(
|
||||
'label' => __( 'Enable Preloader', 'sophia-after-dark' ),
|
||||
'section' => 'sophia_after_dark_section_site',
|
||||
'settings' => 'sophia_after_dark_enable_preloader',
|
||||
'priority' => 5,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Toggle field for Enable/Disable wow animation.
|
||||
@ -72,7 +49,30 @@ function sophia_after_dark_customize_general_panels_sections_register( $wp_custo
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(new WP_Customize_Image_control(
|
||||
$wp_customize, 'sophia_after_dark_home_og_image', array(
|
||||
'label' => __('Home Page Open Graph Image', 'sophia_after_dark'),
|
||||
'section' => 'sophia_after_dark_section_site',
|
||||
'settings' => 'sophia_after_dark_home_og_image',
|
||||
'priority' => 15,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$users = get_users();
|
||||
$user_choices = array();
|
||||
foreach ($users as $user) {
|
||||
$user_choices[$user->ID] = $user->display_name;
|
||||
}
|
||||
$wp_customize->add_control('sophia_after_dark_home_og_user', array(
|
||||
'label' => __('Select User for Open Graph Tags', 'sophia_after_dark'),
|
||||
'section' => 'sophia_after_dark_section_site',
|
||||
'settings' => 'sophia_after_dark_home_og_user',
|
||||
'type' => 'select',
|
||||
'choices' => $user_choices,
|
||||
'priority' => 20,
|
||||
)
|
||||
);
|
||||
/**
|
||||
* Radio image field for Archive Sidebar
|
||||
*
|
||||
@ -91,7 +91,7 @@ function sophia_after_dark_customize_general_panels_sections_register( $wp_custo
|
||||
'description' => __( 'Choose site layout from available layouts', 'sophia-after-dark' ),
|
||||
'section' => 'sophia_after_dark_section_site',
|
||||
'settings' => 'sophia_after_dark_site_layout',
|
||||
'priority' => 15,
|
||||
'priority' => 25,
|
||||
'choices' => array(
|
||||
'site-layout--wide' => get_template_directory_uri() . '/assets/images/full-width.png',
|
||||
'site-layout--boxed' => get_template_directory_uri() . '/assets/images/boxed-layout.png'
|
||||
@ -118,7 +118,7 @@ function sophia_after_dark_customize_general_panels_sections_register( $wp_custo
|
||||
'description' => __( 'Enable/disable Block-based Widgets Editor(since WordPress 5.8).', 'sophia-after-dark' ),
|
||||
'section' => 'sophia_after_dark_section_site',
|
||||
'settings' => 'sophia_after_dark_enable_widgets_editor',
|
||||
'priority' => 15,
|
||||
'priority' => 25,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -24,21 +24,7 @@ function sophia_after_dark_customize_register( $wp_customize ) {
|
||||
$wp_customize->get_section( 'header_image' )->priority = '5';
|
||||
$wp_customize->get_section( 'header_image' )->description = __( 'Header Image for only Innerpages', 'sophia-after-dark' );
|
||||
$wp_customize->add_setting('sophia_after_dark_home_og_image', array('default' => '','sanitize_callback' => 'esc_url_raw','type' => 'option',));
|
||||
$wp_customize->add_control(new WP_Customize_Image_control($wp_customize, 'sophia_after_dark_home_og_image', array('label' => __('Home Page Open Graph Image', 'sophia_after_dark'),'section' => 'title_tagline','settings' => 'sophia_after_dark_home_og_image',)));
|
||||
$wp_customize->add_setting('sophia_after_dark_home_og_user', array('default' => 1,'sanitize_callback' => 'absint','type' => 'option',));
|
||||
|
||||
$users = get_users();
|
||||
$user_choices = array();
|
||||
foreach ($users as $user) {
|
||||
$user_choices[$user->ID] = $user->display_name;
|
||||
}
|
||||
$wp_customize->add_control('sophia_after_dark_home_og_user', array(
|
||||
'label' => __('Select User for Open Graph Tags', 'sophia_after_dark'),
|
||||
'section' => 'title_tagline',
|
||||
'settings' => 'sophia_after_dark_home_og_user',
|
||||
'type' => 'select',
|
||||
'choices' => $user_choices,
|
||||
));
|
||||
$wp_customize->add_setting('sophia_after_dark_home_og_user', array('default' => 1,'sanitize_callback' => 'absint','type' => 'option',));
|
||||
|
||||
if ( isset( $wp_customize->selective_refresh ) ) {
|
||||
$wp_customize->selective_refresh->add_partial( 'blogname', array(
|
||||
@ -102,7 +88,7 @@ add_action( 'customize_controls_enqueue_scripts', 'sophia_after_dark_customize_b
|
||||
/**
|
||||
* Add Kirki required file for custom fields
|
||||
*/
|
||||
require get_template_directory() . '/inc/customizer/mt-customizer-additional-open-graph.php';
|
||||
#require get_template_directory() . '/inc/customizer/mt-customizer-additional-open-graph.php';
|
||||
|
||||
require get_template_directory() . '/inc/customizer/mt-customizer-custom-classes.php';
|
||||
require get_template_directory() . '/inc/customizer/mt-customizer-panels.php';
|
||||
|
Reference in New Issue
Block a user