changed orgization

This commit is contained in:
2024-07-15 22:55:37 -07:00
parent 3f5fb31e99
commit 0f9e1492cc
6 changed files with 63 additions and 126 deletions

View File

@ -364,28 +364,3 @@
.customize-control textarea {
width: 100%;
}
/**---------------------------------------------
Upsell section
---------------------------------------------*/
#customize-controls .control-section-mt-upsell .accordion-section-title:hover,
#customize-controls .control-section-mt-upsell .accordion-section-title:focus {
background-color: #fff;
}
.control-section-mt-upsell .accordion-section-title .button {
margin-top: -4px;
font-weight: 700;
margin-left: 8px;
background: #00d2ff;
background: -webkit-linear-gradient(to right, #3a7bd5, #00d2ff);
background: linear-gradient(to right, #3a7bd5, #00d2ff);
color: #fff;
border:none;
}
.control-section-mt-upsell .accordion-section-title .button:hover {
background: #1FA3E8;
background:linear-gradient(#1FA3E8,#1FA3E8);
}

View File

@ -17,6 +17,41 @@
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="https://gmpg.org/xfn/11">
<?php
$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) . '" />' . "\n";
}
echo '<meta property="og:title" content="' . esc_attr(get_bloginfo('name') . ' - ' . get_bloginfo('description')) . '" />' . "\n";
echo '<meta property="og:description" content="' . esc_attr($author_bio) . '" />' . "\n";
echo '<meta property="og:url" content="' . esc_url(home_url('/')) . '" />' . "\n";
} 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]) . '" />' . "\n";
// Uncomment and adjust the following lines if needed
// $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 . '" />' . "\n";
}
} else {
echo '<meta property="og:image" content="' . esc_url(get_template_directory_uri() . '/assets/images/default-og-image.webp') . '" />' . "\n";
}
echo '<meta property="og:title" content="' . esc_attr(get_the_title()) . '" />' . "\n";
echo '<meta property="og:description" content="' . esc_attr(get_the_excerpt()) . '" />' . "\n";
echo '<meta property="og:url" content="' . esc_url(get_permalink()) . '" />' . "\n";
}
?>
<?php wp_head(); ?>
</head>

View File

@ -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');

View File

@ -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,
)
)
);

View File

@ -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';

View File

@ -138,7 +138,6 @@ function sophia_after_dark_scripts() {
wp_enqueue_style( 'sophia-after-dark-fonts', sophia_after_dark_fonts_url(), array(), null );
wp_enqueue_style( 'lightslider-style', get_template_directory_uri() .'/assets/library/lightslider/css/lightslider.min.css', array(), '' );
wp_enqueue_style( 'animate', get_template_directory_uri(). '/assets/library/animate/animate.min.css', array(), '3.5.1' );
wp_enqueue_style( 'preloader', get_template_directory_uri() .'/assets/css/mt-preloader.css', array(), esc_attr( $sophia_after_dark_theme_version ) );
wp_enqueue_style( 'sophia-after-dark-style', get_stylesheet_uri(), array(), esc_attr( $sophia_after_dark_theme_version) );
wp_enqueue_style( 'sophia-after-dark-responsive-style', get_template_directory_uri(). '/assets/css/mt-responsive.css', array(), esc_attr( $sophia_after_dark_theme_version ) );
@ -173,29 +172,6 @@ function sophia_after_dark_scripts() {
add_action( 'wp_enqueue_scripts', 'sophia_after_dark_scripts' );
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------*/
if ( ! function_exists( 'sophia_after_dark_preloader' ) ) :
/**
* preloader function
*
* @since 1.0.0
*/
function sophia_after_dark_preloader() {
$sophia_after_dark_enable_preloader = get_theme_mod( 'sophia_after_dark_enable_preloader', true );
if ( false === $sophia_after_dark_enable_preloader ){
return;
}
?>
<div id="preloader-background">
<div class="preloader-wrapper">
<div class="sk-spinner sk-spinner-pulse"></div>
</div>
</div>
<?php
}
endif;
add_action( 'sophia_after_dark_before_page', 'sophia_after_dark_preloader', 5 );
if ( ! function_exists( 'sophia_after_dark_font_awesome_social_icon_array' ) ) :