Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function custom_post_taxonomy() {
- register_taxonomy('mixit_cat', 'mixitup_item',
- array(
- 'hierarchical' => true,
- 'label' => 'Mixitup Category',
- 'query_var' => true,
- 'show_admin_column' => true,
- 'rewrite' => array('slug' => 'mixitup-category', 'with_front' => true)
- )
- );
- }
- add_action( 'init', 'custom_post_taxonomy');
- function pages_taxonomy() {
- /*copy start*/
- register_taxonomy('service_cat', 'service-item',
- array(
- 'label' => 'Service Catagory',
- 'hierarchical' => true,
- 'query_var' => true,
- 'show_admin_column' => true,
- 'capabilities' => array(
- 'manage__terms' => 'edit_posts',
- 'edit_terms' => 'manage_catagories',
- 'delete_terms' => 'manage_catagories',
- 'assign_terms' => 'edit_posts'
- ),
- 'rewrite' => array('slug' => 'service-category', 'with_front' => false)
- )
- );
- /*copy end*/
- }
- add_action( 'init', 'pages_taxonomy');
- ?>
- index.php তে এক একটা blog item আসবে অন্য একটা php ফাইল দিয়ে।
- কারন, blog পেজে এ ক্লিক করলে ব্লগ দেখাবে, কিন্তু সাইডবারে থাকা পোস্ট ক্যাটাগরিতে ক্লিক করলে সেই ক্যাটাগরির পোস্টগুলি ব্লগ পেজে শো করবো, এবং পূর্বের পেজের অর্থাৎ blog পেজের স্টাইলই অব্যহত থাকবে। পেজের টাইটেলে লিখা থাকবে কোন ক্যাটাগরি থেকে পোস্ট গুলি শো হচ্ছে।
- এ কাজের জন্য post-excerpt.php ফাইল তৈরি করা লাগবে। এই ফাইলের মধ্যে index.php থেকে একটা সিঙ্গেল ব্লগ আইটেম কপি করে নিতে হবে। পোস্ট লুপ দিয়ে সিঙ্গেল ব্লগ আইটেমটি ঘিরতে হবে।
- যথারীতি টাইটেলের লিংক হবে <?php the_permalink(); ?>, টাইটেল হবে <?php the_title(); ?> , কনটেন্টে হবে <?php the_excerpt(); ?>, ডেটের স্থানে হবে <?php the_date(); ?>,
- এরপর Author এর নামের স্থানে হবে <?php the_author(); ?> , এটি লিখলে author এর নাম টেক্সট আকারে আসবে
- <?php the_author_posts_link(); ?> লিখলে author এর নাম পোস্ট লিংক আকারে আসবে, এই লিংকে ক্লিক করলে ডিফল্ট ভাবে এটি archive.php তে যাবে,
- তবে author.php ফাইল তৈরি করা থাকলে এটি author.php তে লিংকটি আসবে, archive.php না থাকলে এটি index.php তে যাবে
- comments
- একটা কমেন্ট হলে শো করবে 1 comment
- কোন কমেন্ট না থাকলে শো করবে no comment available
- কমেন্ট ডিজেবেল থাকলে শো করবে comment disable
- <?php comments_popup_link( $zero, $one, $more, $css_class, $none ); ?>
- <?php comments_popup_link( 'No comment', 'One comment', '% Comments', '', 'Comment is disabled' ); ?>
- * % = সংখ্যা আনার জন্য
- * $css_class = insert css class if needed
- * $none = কমেন্ট ডিজেবেল থাকলে কি শো করবে
- read more এর লিংক হবে <?php the_permalink(); ?> এবং read more এ ক্লিক করলে সম্পূর্ন পেজ লোড হবে single.php থেকে
- এরপর index.php তে যেখানে ব্লগ পেজ লোড হবে সেখানে post-excerpt.php ফাইলকে কল করতে হবে। <?php get_template_part('post-excerpt'); ?>
- excerpt length
- ===========================================================================
- <?php
- function custom_excerpt_length( $length ) {
- return 20;
- }
- add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
- ?>
- ===========================================================================
- /*post meta*/
- <div class="meta_left">
- <?php _e('Posted by', 'brightpage'); ?> <?php the_author(); ?> <?php _e('on', 'brightpage'); ?> <?php the_time('M d, Y') ?><br />
- <?php the_category(', '); ?><?php if(function_exists("the_tags")) the_tags(' • Tags: ', ', ', ''); ?> <?php if ( comments_open() ) : ?>• <?php _e('Comment feed', 'brightpage'); ?> <?php post_comments_feed_link('RSS 2.0'); ?><?php endif; ?> - <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php _e('Read this post', 'brightpage'); ?></a> <?php edit_post_link('Edit', ' | ', ''); ?>
- </div>
- ===========================================================================
- ( যদি wp pagenavi প্লাগিন থাকে তবে সেটা দেখাবে, আর যদি না থাকে তবে nevigation.php older posts, newer posts দেখাবে )
- post-excerpt.php>>
- <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { include('navigation.php');} ?>
- navigation.php>>
- <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentytwelve' ) ); ?></div>
- <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?></div>
- ===========================================================================
- ( যদি wp pagenavi প্লাগিন থাকে তবে সেটা দেখাবে, আর যদি না থাকে তবে nevigation.php older posts, newer posts দেখাবে )
- post-excerpt.php>>
- <?php if(function_exists('wp_pagenavi')) : ?>
- <div class="pnavi"><?php wp_pagenavi(); ?></div>
- <?php else : ?>
- <div class="alignleft"><?php next_posts_link(__( '<span class="meta-nav">←</span> Older posts', 'twentytwelve' )); ?></div>
- <div class="alignright"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">→</span>', 'twentytwelve' )); ?></div>
- ===========================================================================
- /* single post next previous link */
- <div id="nav-below" class="clearfix">
- <div class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'brightpage' ) . '</span> %title' ); ?></div>
- <div class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '→', 'Next post link', 'brightpage' ) . '</span>' ); ?></div>
- </div><!-- #nav-below -->
- ===========================================================================
- for category
- <?php the_category(); ?>
- example:
- <a href="#">Blog</a>
- <?php the_category(); ?>
- <?php endif; ?>
- ===========================================================================
- <?php if(function_exists('wp_pagenavi')) : ?>
- <?php wp_pagenavi(); ?>
- <?php else : ?>
- <!--default pegination
- -->
- <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment