add ability to change home user in menu

This commit is contained in:
2024-07-15 20:47:48 -07:00
parent 8f5a7a693f
commit 3f5fb31e99
2 changed files with 14 additions and 3 deletions

View File

@ -1,9 +1,7 @@
<?php <?php
function add_opengraph_tags() { function add_opengraph_tags() {
// Get Sophia's user ID $author_id = get_option('sophia_after_dark_home_og_user', 1); // Default to user ID 1 if not set
$author_id = 1; // Replace with the actual user ID of Sophia
// Retrieve Sophia's bio
$author_bio = get_the_author_meta('description', $author_id); $author_bio = get_the_author_meta('description', $author_id);
if (is_front_page()) { if (is_front_page()) {

View File

@ -25,7 +25,20 @@ function sophia_after_dark_customize_register( $wp_customize ) {
$wp_customize->get_section( 'header_image' )->description = __( 'Header Image for only Innerpages', 'sophia-after-dark' ); $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_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_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,
));
if ( isset( $wp_customize->selective_refresh ) ) { if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial( 'blogname', array( $wp_customize->selective_refresh->add_partial( 'blogname', array(