post_content, '' ) ); $format = ( false !== get_post_format() ) ? get_post_format() : 'standard'; $show_excerpt = ( 'excerpt' === generate_get_option( 'post_content' ) ) ? true : false; $show_excerpt = ( 'standard' !== $format ) ? false : $show_excerpt; $show_excerpt = ( $more_tag ) ? false : $show_excerpt; $show_excerpt = ( is_search() ) ? true : $show_excerpt; return apply_filters( 'generate_show_excerpt', $show_excerpt ); } } if ( ! function_exists( 'generate_show_title' ) ) { /** * Check to see if we should show our page/post title or not. * * @since 1.3.18 * * @return bool Whether to show the content title. */ function generate_show_title() { return apply_filters( 'generate_show_title', true ); } } if ( ! function_exists( 'generate_get_premium_url' ) ) { /** * Generate a URL to our premium add-ons. * Allows the use of a referral ID and campaign. * * @since 1.3.42 * * @param string $url URL to premium page. * @param bool $trailing_slash Whether we want to include a trailing slash. * @return string The URL to generatepress.com. */ function generate_get_premium_url( $url = 'https://generatepress.com/premium', $trailing_slash = true ) { if ( $trailing_slash ) { $url = trailingslashit( $url ); } $args = apply_filters( 'generate_premium_url_args', array( 'ref' => null, 'campaign' => null, ) ); if ( isset( $args['ref'] ) ) { $url = add_query_arg( 'ref', absint( $args['ref'] ), $url ); } if ( isset( $args['campaign'] ) ) { $url = add_query_arg( 'campaign', sanitize_text_field( $args['campaign'] ), $url ); } return esc_url( $url ); } } if ( ! function_exists( 'generate_padding_css' ) ) { /** * Shorten our padding/margin values into shorthand form. * * @since 0.1 * * @param int $top Top spacing. * @param int $right Right spacing. * @param int $bottom Bottom spacing. * @param int $left Left spacing. * @return string Element spacing values. */ function generate_padding_css( $top, $right, $bottom, $left ) { $padding_top = ( isset( $top ) && '' !== $top ) ? absint( $top ) . 'px ' : '0px '; $padding_right = ( isset( $right ) && '' !== $right ) ? absint( $right ) . 'px ' : '0px '; $padding_bottom = ( isset( $bottom ) && '' !== $bottom ) ? absint( $bottom ) . 'px ' : '0px '; $padding_left = ( isset( $left ) && '' !== $left ) ? absint( $left ) . 'px' : '0px'; if ( ( absint( $padding_top ) === absint( $padding_right ) ) && ( absint( $padding_right ) === absint( $padding_bottom ) ) && ( absint( $padding_bottom ) === absint( $padding_left ) ) ) { return $padding_left; } return $padding_top . $padding_right . $padding_bottom . $padding_left; } } if ( ! function_exists( 'generate_get_link_url' ) ) { /** * Return the post URL. * * Falls back to the post permalink if no URL is found in the post. * * @since 1.2.5 * * @see get_url_in_content() * @return string The Link format URL. */ function generate_get_link_url() { $has_url = get_url_in_content( get_the_content() ); return $has_url ? $has_url : apply_filters( 'the_permalink', get_permalink() ); } } if ( ! function_exists( 'generate_get_navigation_location' ) ) { /** * Get the location of the navigation and filter it. * * @since 1.3.41 * * @return string The primary menu location. */ function generate_get_navigation_location() { return apply_filters( 'generate_navigation_location', generate_get_option( 'nav_position_setting' ) ); } } /** * Check if the logo and site branding are active. * * @since 2.3 */ function generate_has_logo_site_branding() { if ( get_theme_mod( 'custom_logo' ) && ( ! generate_get_option( 'hide_title' ) || ! generate_get_option( 'hide_tagline' ) ) ) { return true; } return false; } /** * Create SVG icons. * * @since 2.3 */ function generate_get_svg_icon( $icon, $replace = false ) { if ( 'svg' !== generate_get_option( 'icons' ) ) { return; } $output = ''; if ( 'menu-bars' === $icon ) { $output = ''; } if ( 'close' === $icon ) { $output = ''; } if ( 'search' === $icon ) { $output = ''; } if ( 'categories' === $icon ) { $output = ''; } if ( 'tags' === $icon ) { $output = ''; } if ( 'comments' === $icon ) { $output = ''; } if ( 'arrow' === $icon ) { $output = ''; } if ( $replace ) { $output .= ''; } $output = apply_filters( 'generate_svg_icon_element', $output, $icon ); $classes = array( 'gp-icon', 'icon-' . $icon, ); $output = sprintf( '%2$s', implode( ' ', $classes ), $output ); return apply_filters( 'generate_svg_icon', $output, $icon ); } /** * Out our icon HTML. * * @since 2.3 * * @param string $icon * @param bool $replace Whether to include the close icon to be shown using JS. * @return string */ function generate_do_svg_icon( $icon, $replace = false ) { echo generate_get_svg_icon( $icon, $replace ); } /** * Get our media queries. * * @since 2.4 * * @param string $name * @return string The full media query. */ function generate_get_media_query( $name ) { $desktop = apply_filters( 'generate_desktop_media_query', '(min-width:1025px)' ); $tablet = apply_filters( 'generate_tablet_media_query', '(min-width: 769px) and (max-width: 1024px)' ); $mobile = apply_filters( 'generate_mobile_media_query', '(max-width:768px)' ); $mobile_menu = apply_filters( 'generate_mobile_menu_media_query', $mobile ); $queries = apply_filters( 'generate_media_queries', array( 'desktop' => $desktop, 'tablet' => $tablet, 'mobile' => $mobile, 'mobile-menu' => $mobile_menu, ) ); return $queries[ $name ]; }