PATH:
home
/
ajwellnessmassag
/
angelictravels.online
/
wp-content
/
plugins
/
essential-blocks
/
includes
/
Blocks
<?php namespace EssentialBlocks\Blocks; use EssentialBlocks\Core\Block; use EssentialBlocks\Utils\Helper; class AdvancedHeading extends Block { protected $frontend_styles = [ 'essential-blocks-fontawesome' ]; /** * Unique name of the block. * * @return string */ public function get_name() { return 'advanced-heading'; } protected static $default_attributes = [ 'preset' => 'button-1', 'currentPostId' => 0, 'source' => 'custom', 'tagName' => 'h2', 'displaySeperator' => false, 'seperatorPosition' => 'bottom', 'seperatorType' => 'line', 'separatorIcon' => 'fas fa-arrow-circle-down', 'enableLink' => false, 'openInNewTab' => false, 'effects' => '' ]; /** * Block render callback. * * @param mixed $attributes * @param mixed $content * @return mixed */ public function render_callback( $attributes, $content, $block = null ) { if ( is_admin() ) { return; } $attributes = wp_parse_args( $attributes, self::$default_attributes ); $className = isset( $attributes[ "className" ] ) ? $attributes[ "className" ] : ""; $classHook = isset( $attributes[ 'classHook' ] ) ? $attributes[ 'classHook' ] : ''; if ( $attributes[ 'source' ] === 'custom' ) { return $content; } else { // Get post ID from context (Loop Builder) or attributes $post_id = null; if ( $block && isset( $block->context[ 'essential-blocks/postId' ] ) ) { // Use Loop Builder context $post_id = $block->context[ 'essential-blocks/postId' ]; } elseif ( isset( $attributes[ 'currentPostId' ] ) && $attributes[ 'currentPostId' ] ) { // Use attribute value $post_id = $attributes[ 'currentPostId' ]; } if ( $post_id ) { $title = get_the_title( $post_id ); } else { $title = get_the_title(); } if ( ! $title ) { return ''; } // Apply title length limit when provided (e.g., in Loop Builder) if ( isset( $attributes[ 'titleLength' ] ) && intval( $attributes[ 'titleLength' ] ) > 0 ) { $title = wp_trim_words( $title, intval( $attributes[ 'titleLength' ] ), '…' ); } if ( isset( $attributes[ "version" ] ) && $attributes[ "version" ] === '2' ) { $title = sprintf( '<span class="first-title">%s</span>', $title ); } $tag_name = $attributes[ 'tagName' ]; $linkTarget = $attributes[ 'openInNewTab' ] ? '_blank' : ''; if ( isset( $attributes[ 'enableLink' ] ) && $attributes[ 'enableLink' ] ) { $rel = $linkTarget === "_blank" ? 'rel="noopener"' : ''; // Use the same post ID that was used for the title $permalink_post_id = $post_id ? $post_id : null; $permalink = $permalink_post_id ? get_the_permalink( $permalink_post_id ) : get_the_permalink(); $title = sprintf( '<a href="%1$s" target="%2$s" %3$s>%4$s</a>', esc_url( $permalink ), esc_attr( $linkTarget ), $rel, $title ); } if ( $attributes[ 'seperatorType' ] === 'icon' ) { $seperator_icon = sprintf( '%1$s', Helper::eb_render_icon( Helper::eb_get_icon_type( $attributes[ 'separatorIcon' ] ), 'eb-button-icon', $attributes[ 'separatorIcon' ] ) ); } else { $seperator_icon = ''; } if ( $attributes[ 'displaySeperator' ] && $attributes[ 'seperatorPosition' ] === 'top' ) { $seperator_top = sprintf( '<div class="eb-ah-separator %1$s">%2$s</div>', esc_attr( $attributes[ 'seperatorType' ] ), $seperator_icon ); } else { $seperator_top = ''; } if ( $attributes[ 'displaySeperator' ] && $attributes[ 'seperatorPosition' ] === 'bottom' ) { $seperator_bottom = sprintf( '<div class="eb-ah-separator %1$s">%2$s</div>', esc_attr( $attributes[ 'seperatorType' ] ), $seperator_icon ); } else { $seperator_bottom = ''; } $_parent_classes = [ 'eb-parent-wrapper', 'eb-parent-' . $attributes[ 'blockId' ], $classHook ]; $_wrapper_classes = [ 'eb-advance-heading-wrapper', $attributes[ 'blockId' ], $attributes[ 'preset' ], $attributes[ 'effects' ] ]; $parent_attributes = get_block_wrapper_attributes( [ 'class' => implode( ' ', $_parent_classes ) ] ); $wrapper_attributes = get_block_wrapper_attributes( [ 'class' => implode( ' ', $_wrapper_classes ), 'data-id' => $attributes[ 'blockId' ] ] ); $wrapper = sprintf( ' <div %1$s> <div %2$s> %5$s <%3$s class="eb-ah-title">%4$s</%3$s> %6$s </div> </div>', $parent_attributes, $wrapper_attributes, $tag_name, $title, $seperator_top, $seperator_bottom ); return wp_kses_post( $wrapper ); } } }
[-] FlexContainer.php
[edit]
[-] ProductDetails.php
[edit]
[-] WooProductGrid.php
[edit]
[-] Timeline.php
[edit]
[-] Notice.php
[edit]
[-] AdvancedImage.php
[edit]
[-] GoogleMap.php
[edit]
[-] WPForms.php
[edit]
[-] AdvancedVideo.php
[edit]
[-] ProgressBar.php
[edit]
[-] ImageComparison.php
[edit]
[-] AdvancedHeading.php
[edit]
[-] PostGrid.php
[edit]
[-] FormTextField.php
[edit]
[-] ToggleContent.php
[edit]
[-] Text.php
[edit]
[-] PricingTable.php
[edit]
[-] DualButton.php
[edit]
[-] Accordion.php
[edit]
[-] Social.php
[edit]
[-] AdvancedNavigation.php
[edit]
[-] PopUp.php
[edit]
[-] PostBlock.php
[edit]
[-] Form.php
[edit]
[-] Icon.php
[edit]
[-] Tab.php
[edit]
[-] CountDown.php
[edit]
[-] Taxonomy.php
[edit]
[-] TypingText.php
[edit]
[-] AccordionItem.php
[edit]
[-] ProductRating.php
[edit]
[-] ProductImages.php
[edit]
[-] Row.php
[edit]
[-] ShapeDivider.php
[edit]
[-] LottieAnimation.php
[edit]
[-] AddToCart.php
[edit]
[-] FlipBox.php
[edit]
[-] price.php
[edit]
[-] SocialShare.php
[edit]
[-] Slider.php
[edit]
[-] NftGallery.php
[edit]
[-] PostMeta.php
[edit]
[-] InstagramFeed.php
[edit]
[+]
..
[-] InfoBox.php
[edit]
[-] Breadcrumbs.php
[edit]
[-] PostCarousel.php
[edit]
[-] AdvancedTabs.php
[edit]
[-] ParallaxSlider.php
[edit]
[-] Wrapper.php
[edit]
[-] Button.php
[edit]
[-] Openverse.php
[edit]
[-] ImageHotspots.php
[edit]
[-] ImageGallery.php
[edit]
[-] Testimonial.php
[edit]
[-] CallToAction.php
[edit]
[-] FeatureList.php
[edit]
[-] InteractivePromo.php
[edit]
[-] NumberCounter.php
[edit]
[-] TeamMember.php
[edit]
[-] FluentForms.php
[edit]
[-] Column.php
[edit]
[-] TableOfContents.php
[edit]
[-] ProductPrice.php
[edit]