astra_get_custom_button( string $button_text = '', string $button_options = '', string $button_style = '' )
Get custom HTML added by user.
Description
Parameters
- $button_text
-
(string) (Optional) Button Text.
Default value: ''
- $button_options
-
(string) (Optional) Button Link.
Default value: ''
- $button_style
-
(string) (Optional) Button Style.
Default value: ''
Return
(String) Button added by user in options panel.
Source
File: inc/markup-extras.php
function astra_get_custom_button( $button_text = '', $button_options = '', $button_style = '' ) { $custom_html = ''; $button_classes = ''; $button_text = astra_get_option( $button_text ); $button_style = astra_get_option( $button_style ); $outside_menu = astra_get_option( 'header-display-outside-menu' ); $header_button = astra_get_option( $button_options ); $new_tab = ( $header_button['new_tab'] ? 'target="_blank"' : 'target="_self"' ); $link_rel = ( ! empty( $header_button['link_rel'] ) ? 'rel="' . esc_attr( $header_button['link_rel'] ) . '"' : '' ); $button_classes = ( 'theme-button' === $button_style ? 'ast-button' : 'ast-custom-button' ); $outside_menu_item = apply_filters( 'astra_convert_link_to_button', $outside_menu ); if ( '1' == $outside_menu_item ) { $custom_html = '<a class="ast-custom-button-link" href="' . esc_url( do_shortcode( $header_button['url'] ) ) . '" ' . $new_tab . ' ' . $link_rel . '><div class=' . esc_attr( $button_classes ) . '>' . esc_attr( do_shortcode( $button_text ) ) . '</div></a>'; } else { $custom_html = '<a class="ast-custom-button-link" href="' . esc_url( do_shortcode( $header_button['url'] ) ) . '" ' . $new_tab . ' ' . $link_rel . '><div class=' . esc_attr( $button_classes ) . '>' . esc_attr( do_shortcode( $button_text ) ) . '</div></a>'; $custom_html .= '<a class="menu-link" href="' . esc_url( do_shortcode( $header_button['url'] ) ) . '" ' . $new_tab . ' ' . $link_rel . '>' . esc_attr( do_shortcode( $button_text ) ) . '</a>'; } return $custom_html; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |