Blog Feed

Filter Portfolio

<section id="property" class="padding bg_gallery">
  <div class="container">
    <div class="row">
      <div class="col-sm-12 text-center">
        <h2 class="uppercase"><?php the_field('real_estate_title');?> </h2>
        <p class="heading_space"><?php the_field('real_estate__sub_title'); ?></p>
      </div>
    </div>
             <?php 
            // $arfield = array('rent','sale')    
                $terms = get_terms(array('taxonomy' => 'property_category', 'include' => array(8,7),) ); 
                $count = count($terms);  ?>
    <div class="clearfix">
      <div id="filters-property" class="cbp-l-filters-button text-center">
        <div data-filter=".latest" class="cbp-filter-item-active cbp-filter-item">LATEST</div>

            <?php 
            foreach ($terms  as $term) {
            echo $term_list = '<div data-filter=".'.  $term->slug .'" class="cbp-filter-item">' . $term->name . '</div>';
            }
            ?>
           
      </div>
    </div>

    <div id="property-gallery" class="cbp listing1">
        <?php $wpbp = new WP_Query(array( 'post_type' => 'property', 'posts_per_page' =>-1 ) ); ?>
        <?php if ($wpbp->have_posts()) :  while ($wpbp->have_posts()) : $wpbp->the_post(); ?>
        <?php $terms1 = get_the_terms( get_the_ID(), 'property_category' ); ?>
     <div class="cbp-item latest <?php foreach ($terms1  as $term){ echo $term->slug; } ?>">
      <div class="property_item">
        <div class="image">
          <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('medium');?></a>
          <div class="price clearfix"> 
            <span class="tag pull-right"><?php the_field('price');?></span>
          </div>
          <span class="tag_t">For Sale</span> 
          <span class="tag_l">Featured</span>
        </div>
        <div class="proerty_content">
          <div class="proerty_text">
            <h3 class="captlize"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
            <p><?php the_field('property_address');?></p>
          </div>
          <div class="property_meta transparent"> 
            <span><i class="icon-select-an-objecto-tool"></i><?php the_field('property_size');?></span> 
            <span><i class="icon-bed"></i><?php the_field('office_rooms');?></span> 
            <span><i class="icon-safety-shower"></i><?php the_field('bathrooms');?></span>   
          </div>
          <div class="property_meta transparent bottom30">
            <span><i class="icon-old-television"></i><?php the_field('tv_lounge');?></span>
            <span><i class="icon-garage"></i><?php the_field('garages');?></span>
            <span></span>
          </div>
          <div class="favroute clearfix">
            <p><i class="icon-calendar2"></i> <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?></p>
            <ul class="pull-right">
              <li><a href="javascript:void(0)"><i class="icon-like"></i></a></li>
              <li><a href="#seventy" class="share_expender" data-toggle="collapse"><i class="icon-share3"></i></a></li>
            </ul>
          </div>
          <div class="toggle_share collapse" id="seventy">
            <ul>
              <li><a href="<?php echo $f2 = get_field('facebook', 'option');?>/sharer.php?u=<?php the_title(); ?>" class="facebook"><i class="icon-facebook-1"></i> Facebook</a></li>
              <li><a href="<?php echo $tw2 = get_field('twitter', 'option');?>/share?url=<?php the_title(); ?>" class="twitter"><i class="icon-twitter-1"></i> Twitter</a></li>
              <li><a href="<?php echo $ve = get_field('vimo', 'option');?>/share?url=<?php the_title(); ?>" class="vimo"><i class="icon-vimeo3"></i> Vimeo</a></li>
            </ul>
          </div>
        </div>
      </div>
    </div>     
 <?php endwhile; endif; ?>
 <?php wp_reset_query(); ?>
</div>

    <div class="col-sm-12 text-center top20">
     <div class="btn-dark border_radius uppercase margin40" id="loadMore" style="">more listings</div> 
    </div>

  </div>
</section>

  • <a href=”/sharer.php?u=”>Facebook
  • <a href=”/share?url=”>Twitter
  • <a href=”/share?url=”>Vimeo

more listings

Data Deleted by Checkbox

<input type="checkbox" name="vschbox[]" value="<?php echo $post_id; ?>">
<input type="submit" name="delete" id="sufk" class="button action" value="Deleted">
  <?php 
]
global $wpdb;
if(isset($_GET['delete'])){
    $checkbox = $_GET['vschbox'];
    for($i=0;$i<count($checkbox);$i++){
        $del_id = $checkbox[$i]; 

         $wpdb->query( 
            "DELETE FROM wp_posts
             WHERE id IN($del_id)
            "       
        );

        $message = "Data deleted successfully !";
    }
} ?>

Get filter all year in post admin area

<?php 


if (is_admin()){
   //this hook will create a new filter on the admin area for the specified post type
   add_action( 'restrict_manage_posts', function(){
        global $wpdb, $table_prefix;

        $post_type = (isset($_GET['post_type'])) ? quote_smart($_GET['post_type'], true) : 'post';
 
        //only add filter to post type you want
        if ($post_type == 'post'){
            //query database to get a list of years for the specific post type:
            $values = array();
            $query_years = $wpdb->get_results("SELECT year(post_date) as year from ".$table_prefix."posts
                    where post_type='".$post_type."'
                    group by year(post_date)
                    order by post_date");
            foreach ($query_years as &$data){
                $values[$data->year] = $data->year;
            }

            //give a unique name in the select field
            ?><select name="admin_filter_year">
<option value="">All years</option>

                <?php 
                $current_v = isset($_GET['admin_filter_year'])? $_GET['admin_filter_year'] : '';
                foreach ($values as $label => $value) {
                    printf(
                        '<option value="%s"%s>%s</option>',
                        $value,
                        $value == $current_v? ' selected="selected"':'',
                        $label
                    );
                }
                ?>
            </select>
            <?php
        }
    });

    //this hook will alter the main query according to the user's selection of the custom filter we created above:
    add_filter( 'parse_query', function($query){
        global $pagenow;
        $post_type = (isset($_GET['post_type'])) ? quote_smart($_GET['post_type'], true) : 'post';

        if ($post_type == 'post' && $pagenow=='edit.php' && isset($_GET['admin_filter_year']) && !empty($_GET['admin_filter_year'])) {
            $query->query_vars['year'] = $_GET['admin_filter_year'];
        }
    });
}

?>

Add colums image in Post admin area

add_filter( 'manage_post_posts_columns', 'smashing_filter_posts_columns' );
function smashing_filter_posts_columns( $columns ) {
  $columns['image'] = __( 'Image' );
  $columns['price'] = __( 'Price', 'smashing' );
  $columns['area'] = __( 'Area', 'smashing' );
  return $columns;
}


add_action( 'manage_post_posts_custom_column', 'smashing_realestate_column', 10, 2);
function smashing_realestate_column( $column, $post_id ) {
  // Image column
  if ( 'image' === $column ) {
    echo get_the_post_thumbnail( $post_id, array(80, 80) );
  }
}

Contect form7 After submit redirect

<script type="text/javascript">
  
  jQuery('.getelo').hide();
document.addEventListener( 'wpcf7mailsent', function( event ) {
    
    if ( '645' == event.detail.contactFormId ) { //if the form if equals #101

       location = 'http://example.com/thank-you';

    jQuery(".wpcf7-form").fadeOut(300);
      jQuery('.getelo').fadeIn(200);
      jQuery('div.button-section').addClass('getelobuttom');
  }

}, false );

</script>

insert Data Query

global $wpdb;

if(isset($_POST['task'])) {

    $first_name = $wpdb->escape(trim($_POST['first_name']));
    $last_name  = $wpdb->escape(trim($_POST['last_name']));
    $email      = $wpdb->escape(trim($_POST['email']));
    $phonenumber = $wpdb->escape(trim($_POST['phonenumber']));
    $price  = $wpdb->escape(trim($_POST['price']));
    $password  = $wpdb->escape(trim($_POST['password']));


 $urregester = $wpdb->insert('user_register', array(
            'first_name' => $first_name,
            'last_name' => $last_name,
            'email' => $email, 
            'phonenumber' => $phonenumber,
            'price' => $price,
            'password' => $password,
            ));

if ($urregester){
    echo "data insert success fully";

}else {
    echo "trai agin letter";
}



}

Get All Post Type

$get_cpt_args = array(
    'public'   => true
);
$post_typek = get_post_types( $get_cpt_args);

$args = array(
    'post_type' => $post_typek,
    'posts_per_page' => -1,
    // Several more arguments could go here. Last one without a comma.
);
// Query the posts:
$obituary_query = new WP_Query($args);

Login code

session_start();
if (isset($_SESSION['username'])) {
header('location: dashboard.php');
}

if(isset($_POST['submit'])){
  $username = mysqli_real_escape_string($conn, $_POST['username']);
  $password = mysqli_real_escape_string($conn, $_POST['password']);
  
  $query = mysqli_query($conn, "SELECT * FROM users WHERE username = '$username' AND password = '$password' ");
  $rows = mysqli_fetch_array($query);
  if($rows){
      $_SESSION['username'] = $rows['username'];
      header("location: dashboard.php");
  } else {
      $error = "Username Address and Password no match";
  }
  
}