Skip to content

Instantly share code, notes, and snippets.

@shahadat014
Last active August 29, 2015 14:16
Show Gist options
  • Save shahadat014/858a3c080897b596fe20 to your computer and use it in GitHub Desktop.
Save shahadat014/858a3c080897b596fe20 to your computer and use it in GitHub Desktop.
post-excerpt php,page php,sigle php,dynamic style css and js,crows browser support code,default supports code, pagination
// post-excerpt php code
<?php if(have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<article>
<div class="post-image">
<div class="post-heading">
<h3><a href="<?php the_permalink();?>"><?php the_title(); ?></a></h3>
</div>
<?php the_post_thumbnail('post-thumbnail'); ?>
</div>
<?php the_excerpt(); ?>
<div class="bottom-article">
<ul class="meta-post">
<li><i class="icon-calendar"></i><?php the_date(); ?></li>
<li><i class="icon-user"></i><?php the_author_posts_link(); ?> </li>
<li><i class="icon-folder-open"></i><?php the_category(''); ?></li>
<li><i class="icon-comments"></i><?php comments_popup_link( 'No comments yet', '1 comment', '% comments', 'comments-link', 'Comments are off for this post'); ?></li>
</ul>
<a href="<?php the_permalink(); ?>" class="pull-right">Continue reading <i class="icon-angle-right"></i></a>
</div>
</article>
<?php endwhile; ?>
<?php endif; ?>
// page php code
<div class="internal_content">
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; ?>
<?php else : ?>
<h2>4o4 error page not found!</h2>
<?php endif; ?>
</div>
// sigle php code
index php k single php korta hobe
<div class="row">
<div class="col-lg-8">
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; ?>
<?php else : ?>
<h2>4o4 error page not found!</h2>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
</div>
// dynamic style css and js
............1..............
<?php
function news_theme() {
// wp register style
wp_register_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.1.0', 'all' );
// wp enqueue style
wp_enqueue_style( 'bootstrap', get_stylesheet_uri(), array(), '1', 'all' );
// loads of javascript files
wp_enqueue_script('jquery'); // for main jquery
wp_enqueue_script( 'v-foundation', get_template_directory_uri() . '/js/vendor/foundation/foundation.min.js', array('jquery'), '1.0', true);
}
add_action('wp_enqueue_scripts', 'news_theme');
?>
// dynamic style css and js
..........2.............
<?php
function various_theme_jquery() {
wp_enqueue_script('jquery');
}
add_action('init', 'various_theme_jquery');
function news_theme() {
global $wp_styles;
/*
* Adds JavaScript to pages with the comment form to support
* sites with threaded comments (when in use).
*/
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
// wp register style
wp_register_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.1.0', 'all' );
// wp enqueue style
wp_enqueue_style( 'normalize', get_stylesheet_uri(), array(), '1', 'all' );
// main css enqueue style
wp_enqueue_style( 'main-style', get_stylesheet_uri() );
// loads of javascript files
wp_enqueue_script( 'v-foundation', get_template_directory_uri() . '/js/vendor/foundation/foundation.min.js', array('jquery'), '1.0', true);
}
add_action('wp_enqueue_scripts', 'news_theme');
?>
//crows browser support input function php
.........3.................
function ie_specific_js(){?>
<!--[if IE]><script src="js/excanvas.compiled.js"></script><![endif]-->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<?php
}
add_action('wp_head', 'ie_specific_js');
//default supports for theme
...........4.............
<?php
add_theme_support( 'post-formats', array( 'aside', 'audio', 'video', 'gallery' ) );
add_theme_support('post-thumbnails');
add_image_size('sslider-image', 250,200,true);
// pagination for code
<div id="pagination">
<?php if(function_exists('wp_pagenavi')): ?>
<div class="wp-page-navi-various">
<?php wp_pagenavi(); ?>
</div>
<?php else : ?>
<div class="post_navigation single_page_sidebar_navigation">
<?php Previous_posts_link( '<span class="meta-nav">&larr;</span> Previous', 0 ); ?>
<?php next_posts_link( 'Next <span class="meta-nav">&rarr;</span>', 0 ); ?>
</div>
<?php endif; ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment