From 24be03b4275e7c081f1b221f37907e22187fe3cc Mon Sep 17 00:00:00 2001 From: jorge-vitrubio Date: Fri, 23 Dec 2022 18:47:19 +0100 Subject: [PATCH] added widgets to front page, ordered functions files --- functions.php | 59 ++++++++++++++++------------ inc/widgets-register.php | 32 +++++++++++++++ page.php | 4 +- template-parts/frontpage-widgets.php | 10 +---- 4 files changed, 68 insertions(+), 37 deletions(-) create mode 100644 inc/widgets-register.php diff --git a/functions.php b/functions.php index a295661..decda32 100644 --- a/functions.php +++ b/functions.php @@ -72,16 +72,17 @@ function ofisuport_setup() { ); // Set up the WordPress core custom background feature. - add_theme_support( - 'custom-background', - apply_filters( - 'ofisuport_custom_background_args', - array( - 'default-color' => 'ffffff', - 'default-image' => '', - ) - ) - ); + // + //add_theme_support( + // 'custom-background', + // apply_filters( + // 'ofisuport_custom_background_args', + // array( + // 'default-color' => 'ffffff', + // 'default-image' => '', + // ) + // ) + //); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); @@ -94,8 +95,11 @@ function ofisuport_setup() { add_theme_support( 'custom-logo', array( - 'height' => 250, - 'width' => 250, + //'height' => 250, + //'width' => 250, + // not square but rectangle as XarxaProd proportions + 'height' => 252, + 'width' => 125, 'flex-width' => true, 'flex-height' => true, ) @@ -120,20 +124,23 @@ add_action( 'after_setup_theme', 'ofisuport_content_width', 0 ); * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ -function ofisuport_widgets_init() { - register_sidebar( - array( - 'name' => esc_html__( 'Sidebar', 'ofisuport' ), - 'id' => 'sidebar-1', - 'description' => esc_html__( 'Add widgets here.', 'ofisuport' ), - 'before_widget' => '
', - 'after_widget' => '
', - 'before_title' => '

', - 'after_title' => '

', - ) - ); -} -add_action( 'widgets_init', 'ofisuport_widgets_init' ); + +require get_template_directory() . '/inc/widgets-register.php'; + +//function ofisuport_widgets_init() { +// register_sidebar( +// array( +// 'name' => esc_html__( 'Sidebar', 'ofisuport' ), +// 'id' => 'sidebar-1', +// 'description' => esc_html__( 'Add widgets here.', 'ofisuport' ), +// 'before_widget' => '
', +// 'after_widget' => '
', +// 'before_title' => '

', +// 'after_title' => '

', +// ) +// ); +//} +//add_action( 'widgets_init', 'ofisuport_widgets_init' ); /** * Enqueue scripts and styles. diff --git a/inc/widgets-register.php b/inc/widgets-register.php new file mode 100644 index 0000000..dbe4fde --- /dev/null +++ b/inc/widgets-register.php @@ -0,0 +1,32 @@ + esc_html__( 'Front Page - principal', 'ofisuport' ), + 'id' => 'front-page-widgets', + 'description' => esc_html__( 'Add widgets here.', 'ofisuport' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) + ); + register_sidebar( + array( + 'name' => esc_html__( 'Sidebar', 'ofisuport' ), + 'id' => 'sidebar-1', + 'description' => esc_html__( 'Add widgets here.', 'ofisuport' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) + ); + } + add_action( 'widgets_init', 'ofisuport_widgets_init' ); + diff --git a/page.php b/page.php index 25122c0..88e74ed 100644 --- a/page.php +++ b/page.php @@ -17,7 +17,7 @@ get_header();