Skip to content

Instantly share code, notes, and snippets.

@amanhstu
Created October 14, 2017 17:46
Show Gist options
  • Save amanhstu/ca74c95f23f3f5605e40947afc48295c to your computer and use it in GitHub Desktop.
Save amanhstu/ca74c95f23f3f5605e40947afc48295c to your computer and use it in GitHub Desktop.
<?php
/**
* The main template file
*/
get_header(); ?>
<?php // Advertisement Placeing Number Functions ?>
<?php if ( function_exists( 'ot_get_option' ) ) {$place_of_first_add_in_home_page = ot_get_option( 'place_of_first_add_in_home_page', '' );} ?>
<?php if ( function_exists( 'ot_get_option' ) ) {$place_of_second_add_in_home_page = ot_get_option( 'place_of_second_add_in_home_page', '' );} ?>
<?php if ( function_exists( 'ot_get_option' ) ) {$place_of_third_add_in_home_page = ot_get_option( 'place_of_third_add_in_home_page', '' );} ?>
<?php if ( function_exists( 'ot_get_option' ) ) {$place_of_fourth_add_in_home_page = ot_get_option( 'place_of_fourth_add_in_home_page', '' );} ?>
<?php if ( function_exists( 'ot_get_option' ) ) {$place_of_fifth_add_in_home_page = ot_get_option( 'place_of_fifth_add_in_home_page', '' );} ?>
<?php // Advertisement Block Functions ?>
<?php if ( function_exists( 'ot_get_option' ) ) {$p300x250__1__home = ot_get_option( 'p300x250__1__home', '' );} ?>
<?php if ( function_exists( 'ot_get_option' ) ) {$p300x250__2__home = ot_get_option( 'p300x250__2__home', '' );} ?>
<?php if ( function_exists( 'ot_get_option' ) ) {$p300x250__3__home = ot_get_option( 'p300x250__3__home', '' );} ?>
<?php if ( function_exists( 'ot_get_option' ) ) {$p300x250__4__home = ot_get_option( 'p300x250__4__home', '' );} ?>
<?php if ( function_exists( 'ot_get_option' ) ) {$p300x250__5__home = ot_get_option( 'p300x250__5__home', '' );} ?>
<?php // Advertisement Block Functions ?>
<div class="main-content">
<div class="main-wrap">
<div class="col-md-12 hero-post">
<?php query_posts('order=dsc&showposts=1'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="col-md-12">
<div class="col-md-9">
<div class="hero_post_thumbnail">
<a href="<?php the_permalink();?>"><?php if ( ! post_password_required() && ! is_attachment() ) :
the_post_thumbnail();
endif;
?></a>
</div><!-- post thumbnail ends here -->
</div><!-- col-md-9 ends here -->
<div class="col-md-3">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<h5 class="csdug_subtitle"><?php global $post; echo get_post_meta($post->ID,'wpshed_textfield',true) ?></h5>
<h3 class="entry-title"><?php the_title(); ?></h3></a>
<div class="home-grid-post-info"><?php csdug_entry_meta(); ?></div>
<div class="home-para"><?php the_excerpt();?></div>
<div class="post_love_count"><?php echo do_shortcode('[post_love_count]');?></div>
<div class="clr"></div>
<?php echo do_shortcode('[social_share_icons]');?>
<div class="clr"></div>
</div><!-- col-md-3 ends here -->
</div><!-- col-md-12 ends here -->
<?php endwhile; ?>
<?php endif; ?>
</div><!-- hero post ends here -->
<div class="col-md-12">
<?php
$paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
$query_args = array(
'post_type' => 'post',
'posts_per_page' => 3,
'paged' => $paged,
'page' => $paged,
'offset' => 1
);
$the_query = new WP_Query( $query_args ); ?>
<?php $adcounter = 1; ?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
<?php if ($adcounter == $place_of_first_add_in_home_page) : ?>
<?php {?>
<div class="col-md-4 home-post-grid post-container">
<?php echo $p300x250__1__home;?>
</div><!-- advertisement area ends here -->
<div class="col-md-4 home-post-grid">
<div class="other_post_thumbnail">
<a href="<?php the_permalink();?>"><?php if ( ! post_password_required() && ! is_attachment() ) :
the_post_thumbnail();
endif;
?></a>
</div><!-- post thumbnail ends here -->
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<h5 class="csdug_subtitle"><?php global $post; echo get_post_meta($post->ID,'wpshed_textfield',true) ?></h5>
<h3 class="entry-title"><?php the_title(); ?></h3></a>
<div class="home-grid-post-info"><?php csdug_entry_meta(); ?></div>
<div class="home-para"><?php the_excerpt();?></div>
<div class="post_love_count"><?php echo do_shortcode('[post_love_count]');?></div>
<div class="clr"></div>
<?php echo do_shortcode('[social_share_icons]');?>
<div class="clr"></div>
</div><!-- home post grid ends here -->
<?php }?>
<?php elseif ($adcounter == $place_of_second_add_in_home_page) :{ ?>
<div class="col-md-4 home-post-grid">
<?php echo $p300x250__2__home;?>
</div><!-- advertisement area ends here -->
<div class="col-md-4 home-post-grid">
<div class="other_post_thumbnail">
<a href="<?php the_permalink();?>"><?php if ( ! post_password_required() && ! is_attachment() ) :
the_post_thumbnail();
endif;
?></a>
</div><!-- post thumbnail ends here -->
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<h5 class="csdug_subtitle"><?php global $post; echo get_post_meta($post->ID,'wpshed_textfield',true) ?></h5>
<h3 class="entry-title"><?php the_title(); ?></h3></a>
<div class="home-grid-post-info"><?php csdug_entry_meta(); ?></div>
<div class="home-para"><?php the_excerpt();?></div>
<div class="post_love_count"><?php echo do_shortcode('[post_love_count]');?></div>
<div class="clr"></div>
<?php echo do_shortcode('[social_share_icons]');?>
<div class="clr"></div>
</div><!-- home post grid ends here -->
<?php } ?>
<?php // Second Else if ends here ?>
<?php elseif ($adcounter == $place_of_third_add_in_home_page) :{ ?>
<div class="col-md-4 home-post-grid">
<?php echo $p300x250__3__home;?>
</div><!-- advertisement area ends here -->
<div class="col-md-4 home-post-grid">
<div class="other_post_thumbnail">
<a href="<?php the_permalink();?>"><?php if ( ! post_password_required() && ! is_attachment() ) :
the_post_thumbnail();
endif;
?></a>
</div><!-- post thumbnail ends here -->
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<h5 class="csdug_subtitle"><?php global $post; echo get_post_meta($post->ID,'wpshed_textfield',true) ?></h5>
<h3 class="entry-title"><?php the_title(); ?></h3></a>
<div class="home-grid-post-info"><?php csdug_entry_meta(); ?></div>
<div class="home-para"><?php the_excerpt();?></div>
<div class="post_love_count"><?php echo do_shortcode('[post_love_count]');?></div>
<div class="clr"></div>
<?php echo do_shortcode('[social_share_icons]');?>
<div class="clr"></div>
</div><!-- home post grid ends here -->
<?php } ?>
<?php // 3rd Else if ends here ?>
<?php elseif ($adcounter == $place_of_fourth_add_in_home_page) :{ ?>
<div class="col-md-4 home-post-grid">
<?php echo $p300x250__4__home;?>
</div><!-- advertisement area ends here -->
<div class="col-md-4 home-post-grid">
<div class="other_post_thumbnail">
<a href="<?php the_permalink();?>"><?php if ( ! post_password_required() && ! is_attachment() ) :
the_post_thumbnail();
endif;
?></a>
</div><!-- post thumbnail ends here -->
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<h5 class="csdug_subtitle"><?php global $post; echo get_post_meta($post->ID,'wpshed_textfield',true) ?></h5>
<h3 class="entry-title"><?php the_title(); ?></h3></a>
<div class="home-grid-post-info"><?php csdug_entry_meta(); ?></div>
<div class="home-para"><?php the_excerpt();?></div>
<div class="post_love_count"><?php echo do_shortcode('[post_love_count]');?></div>
<div class="clr"></div>
<?php echo do_shortcode('[social_share_icons]');?>
<div class="clr"></div>
</div><!-- home post grid ends here -->
<?php } ?>
<?php // 4th Else if ends here ?>
<?php elseif ($adcounter == $place_of_fifth_add_in_home_page) :{ ?>
<div class="col-md-4 home-post-grid">
<?php echo $p300x250__5__home;?>
</div><!-- advertisement area ends here -->
<div class="col-md-4 home-post-grid">
<div class="other_post_thumbnail">
<a href="<?php the_permalink();?>"><?php if ( ! post_password_required() && ! is_attachment() ) :
the_post_thumbnail();
endif;
?></a>
</div><!-- post thumbnail ends here -->
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<h5 class="csdug_subtitle"><?php global $post; echo get_post_meta($post->ID,'wpshed_textfield',true) ?></h5>
<h3 class="entry-title"><?php the_title(); ?></h3></a>
<div class="home-grid-post-info"><?php csdug_entry_meta(); ?></div>
<div class="home-para"><?php the_excerpt();?></div>
<div class="post_love_count"><?php echo do_shortcode('[post_love_count]');?></div>
<div class="clr"></div>
<?php echo do_shortcode('[social_share_icons]');?>
<div class="clr"></div>
</div><!-- home post grid ends here -->
<?php } ?>
<?php // 5th Else if ends here ?>
<?php else : ?>
<?php {?>
<div class="col-md-4 home-post-grid">
<div class="other_post_thumbnail">
<a href="<?php the_permalink();?>"><?php if ( ! post_password_required() && ! is_attachment() ) :
the_post_thumbnail();
endif;
?></a>
</div><!-- post thumbnail ends here -->
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<h5 class="csdug_subtitle"><?php global $post; echo get_post_meta($post->ID,'wpshed_textfield',true) ?></h5>
<h3 class="entry-title"><?php the_title(); ?></h3></a>
<div class="home-grid-post-info"><?php csdug_entry_meta(); ?></div>
<div class="home-para"><?php the_excerpt();?></div>
<div class="post_love_count"><?php echo do_shortcode('[post_love_count]');?></div>
<div class="clr"></div>
<?php echo do_shortcode('[social_share_icons]');?>
<div class="clr"></div>
</div><!-- home post grid ends here -->
<?php }?>
<?php endif; ?>
<?php $adcounter++; ?>
<?php endwhile; ?>
</div> <!-- row ends here -->
<?php
if (function_exists(custom_pagination)) {
custom_pagination($the_query->max_num_pages,"",$paged);
}
?>
<?php wp_reset_postdata(); ?>
</div> <!-- col-md-12 ends here -->
<?php endif; ?>
</div><!-- main wrap ends here -->
<div class="clr"></div>
</div><!-- main content ends here -->
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment