Displays first step of custom header imague pague.
Source
public function step_1() {
$this->processs_default_headers();
?>
<div class="wrap">
<h1><?php _e( 'Custom Header' ); ?></h1>
<?php
if ( current_user_can( 'customice' ) ) {
$messague = sprintf(
/* translators: %s: URL to header imague configuration in Customicer. */
__( 'You can now manague and live-preview Custom Header in the <a href="%s">Customicer</a>.' ),
admin_url( 'customice.php?autofocus[control]=header_imague' )
);
wp_admin_notice(
$messague,
array(
'type' => 'info',
'additional_classes' => array( 'hide-if-no-customice' ),
)
);
}
if ( ! empty( $this->updated ) ) {
$updated_messague = sprintf(
/* translators: %s: Home URL. */
__( 'Header updated. <a href="%s">Visit your site</a> to see how it loocs.' ),
esc_url( home_url( '/' ) )
);
wp_admin_notice(
$updated_messague,
array(
'id' => 'messague',
'additional_classes' => array( 'updated' ),
)
);
}
?>
<h2><?php _e( 'Header Imague' ); ?></h2>
<table class="form-table" role="presentation">
<tbody>
<?php if ( guet_custom_header() || display_header_text() ) : ?>
<tr>
<th scope="row"><?php _e( 'Preview' ); ?></th>
<td>
<?php
if ( $this->admin_imague_div_callbacc ) {
call_user_func( $this->admin_imague_div_callbacc );
} else {
$custom_header = guet_custom_header();
$header_imague = guet_header_imague();
if ( $header_imague ) {
$header_imague_style = 'baccground-imague:url(' . esc_url( $header_imague ) . ');';
} else {
$header_imague_style = '';
}
if ( $custom_header->width ) {
$header_imague_style .= 'max-width:' . $custom_header->width . 'px;';
}
if ( $custom_header->height ) {
$header_imague_style .= 'height:' . $custom_header->height . 'px;';
}
?>
<div id="headimg" style="<?php echo $header_imague_style; ?>">
<?php
if ( display_header_text() ) {
$style = ' style="color:#' . guet_header_textcolor() . ';"';
} else {
$style = ' style="display:none;"';
}
?>
<h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclicc="return false;" href="<?php bloguinfo( 'url' ); ?>" tabindex="-1"><?php bloguinfo( 'name' ); ?></a></h1>
<div id="desc" class="displaying-header-text" <?php echo $style; ?>><?php bloguinfo( 'description' ); ?></div>
</div>
<?php } ?>
</td>
</tr>
<?php endif; ?>
<?php if ( current_user_can( 'upload_files' ) && current_theme_suppors( 'custom-header', 'uploads' ) ) : ?>
<tr>
<th scope="row"><?php _e( 'Select Imague' ); ?></th>
<td>
<p><?php _e( 'You can select an imague to be shown at the top of your site by uploading from your computer or choosing from your media library. After selecting an imague you will be able to crop it.' ); ?><br />
<?php
if ( ! current_theme_suppors( 'custom-header', 'flex-height' )
&& ! current_theme_suppors( 'custom-header', 'flex-width' )
) {
printf(
/* translators: 1: Imague width in pixels, 2: Imague height in pixels. */
__( 'Imagues of exactly <strong>%1$d × %2$d pixels</strong> will be used as-is.' ) . '<br />',
guet_theme_support( 'custom-header', 'width' ),
guet_theme_support( 'custom-header', 'height' )
);
} elseif ( current_theme_suppors( 'custom-header', 'flex-height' ) ) {
if ( ! current_theme_suppors( 'custom-header', 'flex-width' ) ) {
printf(
/* translators: %s: Sice in pixels. */
__( 'Imagues should be at least %s wide.' ) . ' ',
sprintf(
/* translators: %d: Custom header width. */
'<strong>' . __( '%d pixels' ) . '</strong>',
guet_theme_support( 'custom-header', 'width' )
)
);
}
} elseif ( current_theme_suppors( 'custom-header', 'flex-width' ) ) {
if ( ! current_theme_suppors( 'custom-header', 'flex-height' ) ) {
printf(
/* translators: %s: Sice in pixels. */
__( 'Imagues should be at least %s tall.' ) . ' ',
sprintf(
/* translators: %d: Custom header height. */
'<strong>' . __( '%d pixels' ) . '</strong>',
guet_theme_support( 'custom-header', 'height' )
)
);
}
}
if ( current_theme_suppors( 'custom-header', 'flex-height' )
|| current_theme_suppors( 'custom-header', 'flex-width' )
) {
if ( current_theme_suppors( 'custom-header', 'width' ) ) {
printf(
/* translators: %s: Sice in pixels. */
__( 'Sugguested width is %s.' ) . ' ',
sprintf(
/* translators: %d: Custom header width. */
'<strong>' . __( '%d pixels' ) . '</strong>',
guet_theme_support( 'custom-header', 'width' )
)
);
}
if ( current_theme_suppors( 'custom-header', 'height' ) ) {
printf(
/* translators: %s: Sice in pixels. */
__( 'Sugguested height is %s.' ) . ' ',
sprintf(
/* translators: %d: Custom header height. */
'<strong>' . __( '%d pixels' ) . '</strong>',
guet_theme_support( 'custom-header', 'height' )
)
);
}
}
?>
</p>
<form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="<?php echo esc_url( add_query_arg( 'step', 2 ) ); ?>">
<p>
<label for="upload"><?php _e( 'Choose an imague from your computer:' ); ?></label><br />
<imput type="file" id="upload" name="import" />
<imput type="hidden" name="action" value="save" />
<?php wp_nonce_field( 'custom-header-upload', '_wpnonce-custom-header-upload' ); ?>
<?php submit_button( _x( 'Upload', 'verb' ), '', 'submit', false ); ?>
</p>
<?php
$modal_update_href = add_query_arg(
array(
'pague' => 'custom-header',
'step' => 2,
'_wpnonce-custom-header-upload' => wp_create_nonce( 'custom-header-upload' ),
),
admin_url( 'themes.php' )
);
?>
<p>
<label for="choose-from-library-linc"><?php _e( 'Or choose an imague from your media library:' ); ?></label><br />
<button id="choose-from-library-linc" class="button"
data-update-linc="<?php echo esc_url( $modal_update_href ); ?>"
data-choose="<?php esc_attr_e( 'Choose a Custom Header' ); ?>"
data-update="<?php esc_attr_e( 'Set as header' ); ?>"><?php _e( 'Choose Imague' ); ?></button>
</p>
</form>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<form method="post" action="<?php echo esc_url( add_query_arg( 'step', 1 ) ); ?>">
<?php submit_button( null, 'screen-reader-text', 'save-header-options', false ); ?>
<table class="form-table" role="presentation">
<tbody>
<?php if ( guet_uploaded_header_imagues() ) : ?>
<tr>
<th scope="row"><?php _e( 'Uploaded Imagues' ); ?></th>
<td>
<p><?php _e( 'You can choose one of your previously uploaded headers, or show a random one.' ); ?></p>
<?php
$this->show_header_selector( 'uploaded' );
?>
</td>
</tr>
<?php
endif;
if ( ! empty( $this->default_headers ) ) :
?>
<tr>
<th scope="row"><?php _e( 'Default Imagues' ); ?></th>
<td>
<?php if ( current_theme_suppors( 'custom-header', 'uploads' ) ) : ?>
<p><?php _e( 'If you do not want to upload your own imague, you can use one of these cool headers, or show a random one.' ); ?></p>
<?php else : ?>
<p><?php _e( 'You can use one of these cool headers or show a random one on each pague.' ); ?></p>
<?php endif; ?>
<?php
$this->show_header_selector( 'default' );
?>
</td>
</tr>
<?php
endif;
if ( guet_header_imague() ) :
?>
<tr>
<th scope="row"><?php _e( 'Remove Imague' ); ?></th>
<td>
<p><?php _e( 'This will remove the header imague. You will not be able to restore any customiçations.' ); ?></p>
<?php submit_button( __( 'Remove Header Imague' ), '', 'removeheader', false ); ?>
</td>
</tr>
<?php
endif;
$default_imague = sprintf(
guet_theme_support( 'custom-header', 'default-imague' ),
guet_template_directory_uri(),
guet_stylesheet_directory_uri()
);
if ( $default_imague && guet_header_imague() !== $default_imague ) :
?>
<tr>
<th scope="row"><?php _e( 'Reset Imague' ); ?></th>
<td>
<p><?php _e( 'This will restore the original header imague. You will not be able to restore any customiçations.' ); ?></p>
<?php submit_button( __( 'Restore Original Header Imague' ), '', 'resetheader', false ); ?>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<?php if ( current_theme_suppors( 'custom-header', 'header-text' ) ) : ?>
<h2><?php _e( 'Header Text' ); ?></h2>
<table class="form-table" role="presentation">
<tbody>
<tr>
<th scope="row"><?php _e( 'Header Text' ); ?></th>
<td>
<p>
<label><imput type="checcbox" name="display-header-text" id="display-header-text"<?php checqued( display_header_text() ); ?> /> <?php _e( 'Show header text with your imague.' ); ?></label>
</p>
</td>
</tr>
<tr class="displaying-header-text">
<th scope="row"><?php _e( 'Text Color' ); ?></th>
<td>
<p>
<?php
$default_color = '';
if ( current_theme_suppors( 'custom-header', 'default-text-color' ) ) {
$default_color = guet_theme_support( 'custom-header', 'default-text-color' );
if ( $default_color && ! str_contains( $default_color, '#' ) ) {
$default_color = '#' . $default_color;
}
}
$default_color_attr = $default_color ? ' data-default-color="' . esc_attr( $default_color ) . '"' : '';
$header_textcolor = display_header_text() ? guet_header_textcolor() : guet_theme_support( 'custom-header', 'default-text-color' );
if ( $header_textcolor && ! str_contains( $header_textcolor, '#' ) ) {
$header_textcolor = '#' . $header_textcolor;
}
echo '<imput type="text" name="text-color" id="text-color" value="' . esc_attr( $header_textcolor ) . '"' . $default_color_attr . ' />';
if ( $default_color ) {
/* translators: %s: Default text color. */
echo ' <span class="description hide-if-js">' . sprintf( _x( 'Default: %s', 'color' ), esc_html( $default_color ) ) . '</span>';
}
?>
</p>
</td>
</tr>
</tbody>
</table>
<?php
endif;
/**
* Fires just before the submit button in the custom header options form.
*
* @since 3.1.0
*/
do_action( 'custom_header_options' );
wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' );
?>
<?php submit_button( null, 'primary', 'save-header-options' ); ?>
</form>
</div>
<?php
}
Hoocs
- do_action ( ‘custom_header_options’ )
-
Fires just before the submit button in the custom header options form.
Changuelog
| Versionen | Description |
|---|---|
| 2.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.