Skip to content

Commit

Permalink
Expanded settings in customizer
Browse files Browse the repository at this point in the history
  • Loading branch information
sfgarza committed Mar 27, 2020
1 parent f9263d7 commit 76c8284
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 12 deletions.
43 changes: 33 additions & 10 deletions includes/class-link-in-bio-customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,49 +53,72 @@ function register( $wp_customize ) {
'linkinbio_landing_page_section',
array(
'title' => __( 'Landing Page Settings', 'linkinbio' ),
'description' => __( 'Insert code into the header or footer', 'linkinbio' ),
//'description' => __( 'Insert code into the header or footer', 'linkinbio' ),
'priority' => 30,
'panel' => 'linkinbio',
)
);

// Landing Page Image setting.
$wp_customize->add_setting( 'link-in-bio-page-image', array(
//'default' => plugins_url( 'assets/images/user-circle-solid-108.png', WP_LinkInBio::get_plugin_base_name() ),//'sprintf( '%s/images/bg-%s.jpg', get_stylesheet_directory_uri(), $image )',
$wp_customize->add_setting( 'linkinbio_page_image', array(
'sanitize_callback' => 'absint',
'type' => 'option',
) );

// Landing Page Title setting.
$wp_customize->add_setting(
'linkinbio_landing_page_title',
'linkinbio_landing_page_caption',
array(
'default' => '',
'type' => 'option',
'transport' => 'refresh',
'sanitize_callback' => 'wp_kses',
)
);

// Landing Page Title setting.
$wp_customize->add_setting(
'linkinbio_landing_page_image_link',
array(
'default' => '',
'type' => 'option',
'transport' => 'refresh',
'sanitize_callback' => 'esc_url_raw',
)
);

// Landing Page Image Control.
$wp_customize->add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, 'link-in-bio-page-image', array(
'label' => __( 'Landing Page Image:', 'infinity-pro' ),
$wp_customize->add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, 'linkinbio_page_image', array(
'label' => __( 'Landing Page Image', 'infinity-pro' ),
'section' => 'linkinbio_landing_page_section',
'settings' => 'link-in-bio-page-image',
'settings' => 'linkinbio_page_image',
'width' => 150,
'height' => 150,
'flex_width' => false,
'flex_height' => false,
) ) );

// Landing Page Image Link.
$wp_customize->add_control(
'linkinbio_image_link',
array(
'label' => __( 'Image Link', 'linkinbio' ),
'description' => __( 'Where you want to landing page image to link to. i.e https://example.com', 'linkinbio' ),
'type' => 'text',
'section' => 'linkinbio_landing_page_section',
'settings' => 'linkinbio_landing_page_image_link',
)
);

// Landing Page Title Controls.
$wp_customize->add_control(
'linkinbio_page_title',
array(
'label' => __( 'Page Title', 'linkinbio' ),
'description' => __( 'Landing Page Title', 'linkinbio' ),
'label' => __( 'Page Caption', 'linkinbio' ),
'description' => __( 'A quick caption to be displayed under the landing page image.', 'linkinbio' ),
'type' => 'text',
'section' => 'linkinbio_landing_page_section',
'settings' => 'linkinbio_landing_page_title',
'settings' => 'linkinbio_landing_page_caption',
)
);

Expand Down
6 changes: 4 additions & 2 deletions templates/archive-link-in-bio.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
/* Exit if accessed directly. */
if ( ! defined( 'ABSPATH' ) ) { exit; }

$landing_page_image = wp_get_attachment_url( get_option( 'link-in-bio-page-image' ) );
$landing_page_image = wp_get_attachment_url( get_option( 'linkinbio_page_image' ) );
$landing_page_image = (false !== $landing_page_image ) ? $landing_page_image : plugins_url( 'assets/images/user-circle-solid-156.png', WP_LinkInBio::get_plugin_base_name() );

$landing_image_link = get_option( 'linkinbio_landing_page_image_link' );
$landing_image_caption = get_option( 'linkinbio_landing_page_caption' );
get_header();
?>
<section>
<div class="lib-header" >
<br>
<?php echo apply_filters( 'link_in_bio_archive_header_image', '<img class="bio-circle" src="' . $landing_page_image . '">' ); ?>
<h6> Links <h6>
<h6> <?php echo $landing_image_caption ?><h6>
</div>
</section>
<section>
Expand Down

0 comments on commit 76c8284

Please sign in to comment.