Brillianaire | HTML shortcode
<?php
add_shortcode( 'shortcode_name', function () {
$out = '<p>write your HTML shortcode content here</p>';
return $out;
} );
add_action('after_setup_theme', function() {
add_image_size( 'ajs-service-loop', 768, 590, true );
});
add_action('after_setup_theme', function() {
add_image_size( 'ajs-discover-loop', 400, 400, true );
});
//Services Home Loop
add_shortcode( 'safe_service_custom_loop', function() {
ob_start();
?>
<div class="block-item">
<div class="grid-item-inner " data-wow-duration="1.3s">
<div class="post-image">
<?php the_post_thumbnail('ajs-service-loop'); ?>
<!-- <img src="https://ajsfacilities.co.uk/wp-content/uploads/2020/07/Handyman-Services.jpg" alt="service4"> -->
</div>
<div class="entry-body">
<h4 class="entry-title">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h4>
<div class="entry-content">
<?php echo wp_trim_words( get_the_content(), 12, '...' ); ?>
</div>
<div class="safe-left-right-content">
<div class="entry-readmore">
<a class="btn-more" href="<?php the_permalink(); ?>">Read more<i class="fas fa-plus"></i></a>
</div>
<div class="btn-safe">
<a href="#" class="book-now-me elementor-button-link elementor-button elementor-size-sm" data-id="<?php the_ID(); ?>">Book Now</a>
</div>
</div>
</div>
</div>
</div>
<?php
return ob_get_clean();
} );
//Services Home Loop
add_shortcode( 'safe_book_form_post_title', function() {
ob_start();
?>
<div class="block-item">
<div class="grid-item-inner">
<div class="entry-body">
<h4 class="entry-title">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h4>
</div>
</div>
</div>
<?php
return ob_get_clean();
} );
//Self Discover Loop
add_shortcode( 'safe_discover_custom_loop', function() {
ob_start();
?>
<div class="safe-loop-11">
<div class="loop-blog-item">
<div class="content-left">
<div class="post-image">
<?php the_post_thumbnail('ajs-discover-loop'); ?>
</div>
</div>
<div class="content-middle">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p><?php echo wp_trim_words( get_the_content(), 35, '...' ); ?> </p>
</div>
<div class="content-right">
<a href="<?php the_permalink(); ?>" class="btn-red">Read More</a>
</div>
</div> <!-- /.loop-blog-item -->
</div> <!-- /.safe-loop-11 -->
<?php
return ob_get_clean();
} );
//Events Loop
add_shortcode( 'safe_events_custom_loop', function() {
ob_start();
?>
<div class="eve">
<div class="ovaev-content content-list">
<div class="extra-event">
<div class="desc">
<a href="<?php the_permalink(); ?>" class="event-thumbnail" style="background-image:url(<?php echo esc_url( get_field( 'square_image_300x300' ) ); ?>);">
<img width="160" height="160" src="<?php echo esc_url( get_field( 'square_image_300x300' ) ); ?>" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="">
</a>
<div class="event_post">
<div class="post_cat">
<a class="event_type" href="#">
<?php if ( $sub_title = get_field( 'sub_title' ) ) : ?>
<?php echo esc_html( $sub_title ); ?>
<?php endif; ?>
</a>
</div>
<h2 class=" event_title">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h2>
</div>
</div>
</div>
<div class="event-readmore">
<a href="<?php the_permalink(); ?>" class="readmore "> More Details </a>
</div>
</div>
</div>
<?php
return ob_get_clean();
} );
add_shortcode( 'safe_custom_blog_loop', function() {
ob_start();
?>
<!-- Loop Item Start -->
<div class="post-loop-block-pwd">
<div class="post-thumb-block-pwd">
<?php the_post_thumbnail();?>
</div>
<div class="post-content-block-pwd">
<div class="post-date"><?php echo get_the_date( 'F j, Y' );?></div>
<div class="blog-block-inner">
<div class="post-meta-block">
<div class="author-items-center">
<div class="post-author">
<i class="far fa-user"></i><span class="author vcard"><?php the_author(); ?></span>
</div>
<div class="post-comments">
<i class="far fa-comment-dots"></i><span><?php comments_number( 'no comment', '1 comment', '% comments' ); ?></span>
</div>
</div>
</div>
<h3 class="post-title-block"><a href="<?php the_permalink();?>"><?php the_title();?></a></h3>
<div class="post-excerpt-block"> <?php echo wp_trim_words( get_the_content(), 12, '...' ); ?></div>
<div class="post-read-more"> <a class="btn-more" href="<?php the_permalink();?>">Read more<i class="fas fa-angle-right"></i></a> </div>
</div>
</div>
</div>
<!-- /Loop Item End -->
<?php
return ob_get_clean();
} );
//Event Single Info
add_shortcode( 'safe_portfolio_single_info', function() {
ob_start();
?>
<div class="portfolio-details-info">
<ul>
<?php if ( $sub_title = get_field( 'sub_title' ) ) : ?>
<li>
<div class="icon">
<i class="fas fa-tag"></i>
</div>
<span>Event Topic </span>
<p>
<?php echo esc_html( $sub_title ); ?>
</p>
</li>
<?php endif; ?>
</ul>
</div> <!-- /.portfolio-details-info -->
<?php
return ob_get_clean();
} );
// Testimonials
add_shortcode( 'safe_custom_testimonial_slider', function() {
ob_start();
?>
<div class="testimonial-slider">
<?php
$query = new WP_Query( array(
'post_type' => 'testimonial',
'posts_per_page' => -1,
) );
foreach( $query->posts as $loop_post ) :
global $post;
setup_postdata( $loop_post );
?>
<div class="testimonial-single-item">
<div class="testimonial-pic">
<?php
$client_picture = get_field( 'client_picture' , $loop_post);;
if ( $client_picture ) : ?>
<img src="<?php echo esc_url( $client_picture['url'] ); ?>" alt="<?php echo esc_attr( $client_picture['alt'] ); ?>" />
<?php endif; ?>
</div>
<h3 class="testimonial-title">
<?php echo get_the_title( $loop_post ); ?>
<span class="testimonial-post">
<?php if ( $client_designation = get_field( 'client_designation', $loop_post )) : ?>
<?php echo esc_html( $client_designation ); ?>
<?php endif; ?>
</span>
</h3>
<div class="testimonial-des">
<!-- <?php echo wp_trim_words( get_the_content(), 40, '...' ); ?> -->
<?php the_content( 'Read more ...' ); ?>
</div>
<?php if ( $video_feedback_youtube_url = get_field( 'video_feedback_youtube_url', $loop_post )) : ?>
<div class="popupblox_play_icon">
<a href="<?php echo esc_url( $video_feedback_youtube_url ); ?>" data-fancybox>
<span class="video-button">
<i class="fas fa-play"> </i>
</span>
</a>
</div>
<?php endif; ?>
</div>
<?php
endforeach;
wp_reset_postdata();
?>
</div> <!-- /.testimonial-slider -->
<?php
return ob_get_clean();
} );