Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html lang="en-US">
- <head>
- <meta charset="UTF-8">
- <title></title>
- </head>
- <body>
- <!-- www.underscores.me
- theme generate site যেখান থেকে থিমের সোর্স কোড পাওয়া যায়।
- -->
- <!-- title dynamic -->
- <?php bloginfo('name'); ?><?php wp_title(); ?>
- <!-- example -->
- <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
- <!-- stylesheet dynamic -->
- <?php bloginfo('stylesheet_url'); ?>
- <!-- example -->
- <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" media="screen" />
- <!-- link and image dynamic -->
- <?php echo get_template_directory_uri(); ?>
- <!-- getting wordpress head -->
- <?php wp_head(); ?>
- <?php wp_footer(); ?>
- <!-- (Homepage)Welcome Template would be used as Home -->
- <!-- Blog কে Default Template হিসাবে ব্যবহার করতে হবে-->
- <!-- go settings> reading> Front page displays> a static page -->
- <!-- Front page> Home -->
- <!-- Posts page> Blog> save change -->
- <!-- header h1 dynamic -->
- <?php bloginfo('title'); ?> - <?php bloginfo('description'); ?>
- example:
- <a class="brand" href="index.html"><?php bloginfo('title'); ?> - <?php bloginfo('description'); ?></a>
- <!-- menu register -->
- <!-- function register -->
- <!-- >create functions.php and write this code-->
- <?php
- add_action('init', 'wpj_register_menu'); /*"fallback menu"*/
- function wpj_register_menu() {
- if (function_exists('register_nav_menu')) {
- register_nav_menu( 'wpj-main-menu', __( 'Main Menu', 'brightpage' ) );
- }
- }
- function wpj_default_menu() {
- echo '<ul class="nav pull-right">'; /*"class changeable"*/
- if ('page' != get_option('show_on_front')) {
- echo '<li><a href="'. home_url() . '/">Home</a></li>';
- }
- wp_list_pages('title_li=');
- echo '</ul>';
- }
- ?>
- <!-- then call this menu to header -->
- <?php
- if (function_exists('wp_nav_menu')) {
- wp_nav_menu(array('theme_location' => 'wpj-main-menu', 'menu_id' => 'dropmenu', 'fallback_cb' => 'wpj_default_menu'));
- }
- else {
- wpj_default_menu();
- }
- ?>
- <!-- 'menu_id' => 'dropmenu' it's changeable //if it were a class then it would be 'menu_class' => 'classname' -->
- <!-- another menu register code -->
- <?php
- register_nav_menus( array(
- 'mainmenu' => __( 'Mainmenu Menu' ), //mainmenu =register id //Mainmenu Menu = Theme location name
- ) );
- ?>
- <!-- then call this menu to header -->
- <?php wp_nav_menu(array('theme_location' => 'mainmenu', 'menu_class' => 'container')); ?> <!--menu class is changeable-->
- <!-- or -->
- <?php
- if (function_exists('wp_nav_menu')) {
- wp_nav_menu(array('theme_location' => 'wpj-main-menu', 'menu_id' => 'dropmenu', 'fallback_cb' => 'wpj_default_menu'));
- }
- else {
- wpj_default_menu();
- }
- ?>
- <!-- wordpress jquery -->
- <?php
- function latest_jquery_call() {
- wp_enqueue_script('jquery');
- }
- add_action('init', 'latest_jquery_call');
- ?>
- যখন এই জেকুয়ারি ফাংশনে ব্যবহার করা হবে, তখন index.html এ আগের কল করা জেকুয়ারি ডিলিট করে দিতে হবে।
- wordpress এ যখন জেকুয়ারি ব্যবহার করা হবে, তখন $ সাইন আর ব্যবহার করা যাবে না।
- এর বদলে jQuery ব্যবহার করতে হবে। সব জেকুয়ারি ফাইলেই এটা রিপ্লেস করতে হবে।
- <!-- wordpress jquery -->
- <!-- another wordpress jquery -->
- <?php
- /*eita hoyni
- function insert_jquery(){
- wp_enqueue_script('jquery');
- }
- add_filter('wp_head','insert_jquery');
- */
- //eita kaj hoyese and change $ sign and input there jQuery everywhere
- function ppm_lightbox_latest_jquery() {
- wp_enqueue_script('jquery');
- }
- add_action('init', 'ppm_lightbox_latest_jquery');
- ?>
- <!-- Page.php create -->
- <!-- wordpress এ যেকোন page তৈরি করতে হলে loop ব্যবহার করতে হবে -->
- <!-- নিচের এটা একটা লুপের উদাহরন -->
- <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
- <div class="post" id="post-<?php the_ID(); ?>">
- <div id="post-title" class="clearfix full">
- <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
- </div> <!-- end div .post-title -->
- <div class="entry">
- <?php the_content(); ?>
- <div class="space"></div>
- <?php get_template_part( 'postmeta' ); // Post Meta (postmeta.php) ?>
- <?php wp_link_pages(); ?>
- <!-- <?php trackback_rdf(); ?> -->
- </div> <!-- end div .entry -->
- <?php comments_template( '', true ); ?>
- </div> <!-- end div .post -->
- <?php endwhile; ?>
- <?php else : ?>
- <div class="post">
- <h3><?php _e('404 Error: Not Found', 'brightpage'); ?></h3>
- </div>
- <?php endif; ?>
- <!-- লুপ শেশ -->
- <!-- page.php post code -->
- <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
- <?php endwhile; ?>
- <?php else : ?>
- <div class="post">
- <h3><?php _e('404 Error: Not Found', 'brightpage'); ?></h3>
- </div>
- <?php endif; ?>
- <!-- Default post query -->
- <!-- এখন লুপের যা দরকার -->
- <?php if(have_posts()) : ?>
- <?php while(have_posts()) : the_post(); ?>
- <!-- Here is div -->
- <?php endwhile; ?>
- <?php else : ?>
- <section class="four_zero_four">
- <h3><?php _e('404 Error: Not Found', 'brightpage'); ?></h3>
- </section>
- <?php endif; ?>
- <!-- যদি icon দরকার হয়, তবে তার ডাইনামিক কোড -->
- <?php
- $icon = get_post_meta($post->ID, 'icon', true);
- ?>
- <?php if($icon) : ?>
- <i class="icon-<?php echo $icon; ?> page-title-icon"></i>
- <?php else : ?>
- <i class="icon-home page-title-icon"></i>
- <?php endif; ?>
- <!-- Custom field -->
- <?php echo get_post_meta($post->ID, 'id', true); ?>
- <!-- Custom field variable -->
- <?php
- $box_icon = get_post_meta($post->ID, 'box_icon', true);
- ?>
- <?php echo $box_icon; ?>
- <!-- Conditional Custom field use -->
- <?php if($box_icon) : ?>
- <div class="pull-left icon-holder">
- <span class="entypo-<?php echo $box_icon; ?>"></span>
- </div>
- <?php endif; ?>
- <!-- যদি h2 টাইটেলের দরকার হয়, তবে তার ডাইনামিক কোড -->
- <h2><?php the_title(); ?></h2>
- <!-- যদি p টাইটেলের দরকার হয়, তবে তার ডাইনামিক কোড -->
- <p><?php echo get_post_meta($post->ID, 'subtitle', true); ?></p>
- <!-- যদি p টাইটেলের দরকার হয়, তবে if দিয়ে তার ডাইনামিক কোড হবে, (for custom field)-->
- <!-- সাধারন কোড উদাহরন -->
- <p><?php echo get_post_meta($post->ID, 'Phone', true); ?></p>
- <!--if else দিয়ে কোড উদাহরন -->
- <?php
- $Phone = get_post_meta($post->ID, 'Phone', true);
- ?>
- <?php if($Phone) : ?>
- <p><?php echo get_post_meta($post->ID, 'Phone', true); ?></p>
- <?php else : ?>
- <p>need a phone number </p>
- <?php endif; ?>
- <!--if দিয়ে কোড উদাহরন -->
- <?php
- $Phone = get_post_meta($post->ID, 'Phone', true);
- ?>
- <?php if($Phone) : ?>
- <p><?php echo get_post_meta($post->ID, 'Phone', true); ?></p>
- <!-- এখন লুপের যা দরকার শেষ-->
- <!--widget register -->
- <!--widget register এর জন্য এই কোডটা functions.php তে বসাতে হবে -->
- <?php
- /* Register sidebars and widgetized areas ********************************************/
- function brightpage_widget_areas() {
- register_sidebar( array(
- 'name' => __( 'Footer Left', 'brightpage' ),
- 'id' => 'footer_left',
- 'description' => __( 'An optional widget area for your welcome message area.', 'brightpage' ),
- 'before_widget' => '<div class="big">',
- 'after_widget' => '</div>',
- 'before_title' => '',
- 'after_title' => '',
- ) );
- }
- add_action('widgets_init', 'brightpage_widget_areas');
- ?>
- <!--widget register এর জন্য এই কোডটা html এ বসাতে হবে-->
- <?php dynamic_sidebar('footer_left'); ?>
- <!-- অথবা -->
- <!--এই কোডটা html এ বসাতে হবে
- (যদি উইজেড এ লিখা হয় তখন সেটা প্রকাশিত হবে। প্রকাশিত না হলে ডিফল্ট লিখা শো করবে। )-->
- <?php if ( ! dynamic_sidebar( 'footer_left' ) ) : ?>
- <!-- এর মধ্যে ডিফল্ট html লিখাগুলি বসিয়ে রাখতে হবে। -->
- <?php endif; ?>
- <!-- যদি title দরকার হয়, তবে তার ডাইনামিক কোড -->
- <?php the_title(); ?>
- <!-- যদি content দরকার হয়, তবে তার ডাইনামিক কোড -->
- <?php the_content(); ?>
- <!-- slider -->
- some popular slider
- http://codecanyon.net/item/mega-slider-responsive-wordpress-slider-plugin/4673193
- http://codecanyon.net/item/layerslider-responsive-wordpress-slider-plugin-/1362246
- <!-- shortcode wordpress -->
- <?php
- function youtube_shortcode( $atts, $content = null ) {
- return '<iframe width="560" height="315" src="//www.youtube.com/embed/'.$content.'" frameborder="0" allowfullscreen></iframe>';
- }
- add_shortcode('youtube', 'youtube_shortcode');
- ?>
- <!-- end shortcode wordpress -->
- <!-- shortcode wordpress -->
- 3types of shortcode
- [link]content[/link]
- [link url="http://google.com" title="Google"]
- [link url="http://google.com"]Google [/link]
- <?php
- function youtube_shortcode( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'width' => '560',
- 'height' => '315'
- ), $atts ) );
- return '<iframe width="'.$width.'" height="'.$height.'" src="//www.youtube.com/embed/'.$content.'" frameborder="0" allowfullscreen></iframe>';
- }
- /* '.$attribute.' */
- add_shortcode('youtube', 'youtube_shortcode');
- ?>
- [youtube width="" height=""]sfdfsdf[/youtube]
- থিমের যেকোন যায়গায় শর্টকোড দিয়ে বাটন ব্যবহার করা যায় এই কোড দিয়ে
- <?php
- function button_shortcode( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'color' => '#4285F4',
- 'url' => '',
- 'text' => 'Read More',
- ), $atts ) );
- return '<a href="'.$url.'" class="s_button" style="background-color:'.$color.'">'.$text.' </a>';
- }
- add_shortcode('button', 'button_shortcode');
- ?>
- অথবা এভাবে
- <?php
- function button_shortcode( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'color' => '#4285F4',
- 'url' => '',
- 'text' => 'Read More',
- 'hover' => '#ddd',
- ), $atts ) );
- return '
- <style type="text/css">
- a.s_button{background-color:'.$color.'}
- a.s_button:hover{background-color: '.$hover.';}
- </style>
- <a href="'.$url.'" class="s_button">'.$text.' </a>';
- }
- add_shortcode('button', 'button_shortcode');
- ?>
- থিমের যেকোন যায়গায় বাটন শর্টকোড ব্যবহার করার অনেক গুলো বাটনে যদি ভিন্ন ভিন্ন কালার দেবার প্রয়োজন হয় সেক্ষেত্রে >বাটনের একটা আই ডি দিতে হবে >আর একটা এ্যাট্রিবিউট রেজিস্টার করতে হবে আই ডি নামে
- <?php
- function button_shortcode( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'color' => '#4285F4',
- 'url' => '',
- 'text' => 'Read More',
- 'hover' => '#ddd',
- 'id' => 'btn', /*একটা এ্যাট্রিবিউট রেজিস্টার করতে হবে আই ডি নামে*/
- ), $atts ) );
- return '
- <style type="text/css">
- এখানে এই লাইন টা চেঞ্জ হবে, নিচের লাইন বসবে, অর্থাৎ স্টাইলশিট ডাইনামিক হবে a.s_button{background-color:'.$color.'}
- a#button'.$id.'{background-color:'.$color.'}
- এখানে এই লাইন টা চেঞ্জ হবে, নিচের লাইন বসবে, অর্থাৎ স্টাইলশিট ডাইনামিক হবে a.s_button:hover{background-color: '.$hover.';}
- a#button'.$id.':hover{background-color: '.$hover.';}
- </style>
- <a id="button'.$id.'" /*এখানে বাটনের একটা আই ডি দিতে হবে, তারপর ডাইনামিক কোড দিতে হবে*/ href="'.$url.'" class="s_button">'.$text.' </a>';
- }
- add_shortcode('button', 'button_shortcode');
- ?>
- [button id="1" url="#" hover="green" text="sample text"]
- [button id="2" url="#" hover="green" text="sample text"]
- [button id="সবগুলি আইডি ইউনিক হবে, ভিন্ন ভিন্ন কালার দিতে হলে" url="#" hover="green" text="sample text"]
- থিমের যেকোন যায়গায় শর্টকোড ব্যবহার করা যায় এই কোড দিয়ে
- <?php echo do_shortcode('here is shortcode'); ?>
- কিন্তু উইজেডের ভেতর ডিফল্ট ভাবে শর্টকোড দিলে কাজ করবে না।
- এজন্য ফাংশনে একটা ফিল্টার যুক্ত করতে হবে।
- functions.php এর মধ্যে নিচের কোডটা দিতে হবে
- <?php
- add_filter('widget_text', 'do_shortcode');
- ?>
- <?php
- function my_shortcode_handler( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'attr_1' => 'attribute 1 default',
- ), $atts ) );
- }
- ?>
- for email sent in wordpress: zpack plugin
- syntax highlighter wordpress plugin
- https://wordpress.org/plugins/syntaxhighlighter/installation/
- http status code
- http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
- <!-- featured image code -->
- <?php
- add_theme_support( 'post-thumbnails', array( 'post' ) );
- ?>
- <!-- featured image code -->
- <?php the_post_thumbnail('post-image', array('class' => 'imgthumb')); ?>
- <!-- যদি ফিচারড ইমেজ থাকে তবে ফিচারড ইমেজ শো কর, আর যদি ফিচারর্ড ইমেজ না থাকে তবে ডিরেক্টরি থেকে ডিফল্ট ইমেজ শো কর -->
- <?php
- $f_image = the_post_thumbnail('post-image', array('class' => 'imgthumb'));
- ?>
- <?php if($f_image) : ?>
- <?php echo $f_image; ?>
- <?php else : ?>
- <img src="<?php echo get_template_directory_uri(); ?>/img/imagename.jpg" alt="" />
- <?php endif; ?>
- <!-- শর্ট কোড two_column single_column -->
- <?php
- function column_wrapper_shortcode( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'type' => '',
- 'text' => 'dfsfds',
- ), $atts ) );
- return '
- <div class="two_column">'.do_shortcode($content).'</div>
- ';
- }
- add_shortcode('twocol', 'column_wrapper_shortcode');
- function single_wrapper_shortcode( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'type' => '',
- 'text' => '',
- ), $atts ) );
- return '
- <div class="single_column">'.do_shortcode($content).'</div>
- ';
- }
- add_shortcode('scol', 'single_wrapper_shortcode');
- ?>
- custom post registration (address: http://codex.wordpress.org/Post_Types)
- <?php
- add_action( 'init', 'create_posttype'/*portfolio_custom_post*/ );
- function create_posttype() {
- register_post_type( 'acme_product'/*Portfolio Items*/,
- array(
- 'labels' => array(
- 'name' => __( 'Products'/*Portfolios*/ ),
- 'singular_name' => __( 'Portfolio' ),
- ),
- 'public' => true,
- 'has_archive' => true,
- 'rewrite' => array('slug' => 'products'/*portfolio-item*/),
- )
- );
- }
- ?>
- *(add_action( 'init', 'create_posttype' ); > কাস্টম পোস্ট তৈরি করার ফাংশনটা ইনিশিয়াল ভাবে এ্যাড করা হচ্ছে)
- *add_action ও function এর নাম <!--create_posttype-->এর বদলে যেকোন নাম ব্যবহার করা যায়।
- *register_post_type এ যে নাম ব্যবহার করা হবে সেটাই রেজিস্টার পোস্টের আইডি হিসাবে বিবেচিত হবে। যেমন: acme_product
- *'name' => __( 'portfolios' ), এই নামটা মেনুতে একটা আইটেম হিসাবে দেখানো হবে।
- *'singular_name' => __( 'Portfolio' ) হবে
- *'rewrite' => array('slug' => 'portfolio-item'),
- 'public' => true, এর মানে, এটা সবাই দেখতে পাবে। false হলে এটা শুধু এ্যাডমিন দেখতে পাবে।
- 'has_archive' => true, পোস্টের আর্কাইভ সিস্টেম দেখতে হলে এটা true থাকতে হবে।
- 'add_new_item' => __( 'Add New Portfolio' ) নতুন পোস্ট নেয়া হলে পোস্টের শুরুতে এটা টাইটেল হিসাবে শো করবে।
- 'supports' => array('author', 'thumbnail', 'title', 'editor', 'custom-fields'), সাপোর্টের মধ্যে যা যা শো করাতে চাই সেগুলো লিখতে হবে।
- <?php
- add_action( 'init', 'create_posttype' );
- function create_posttype() {
- register_post_type( 'acme_product',
- array(
- 'labels' => array(
- 'name' => __( 'portfolios' ),
- 'singular_name' => __( 'Portfolio' )
- ),
- 'public' => true,
- 'has_archive' => true,
- 'rewrite' => array('slug' => 'portfolio-item'),
- )
- );
- }
- ?>
- <!-- costom post labels (address http://codex.wordpress.org/Function_Reference/register_post_type) -->
- 'name' - general name for the post type, usually plural. The same as, and overridden by $post_type_object->label
- 'singular_name' - name for one object of this post type. Defaults to value of name
- 'menu_name' - the menu name text. This string is the name to give menu items. Defaults to value of name label
- 'name_admin_bar' - name given for the Add New dropdown on admin bar. Defaults to singular name if it exists, name otherwise.
- 'all_items' - the all items text used in the menu. Default is the Name label
- 'add_new' - the add new text. The default is Add New for both hierarchical and non-hierarchical types. When internationalizing this string, please use a gettext context matching your post type. Example: _x('Add New', 'product');
- 'add_new_item' - the add new item text. Default is Add New Post/Add New Page
- 'edit_item' - the edit item text. Default is Edit Post/Edit Page
- 'new_item' - the new item text. Default is New Post/New Page
- 'view_item' - the view item text. Default is View Post/View Page
- 'search_items' - the search items text. Default is Search Posts/Search Pages
- 'not_found' - the not found text. Default is No posts found/No pages found
- 'not_found_in_trash' - the not found in trash text. Default is No posts found in Trash/No pages found in Trash
- 'parent_item_colon' - the parent text. This string isn't used on non-hierarchical types. In hierarchical ones the default is Parent Page
- <!-- supports -->
- 'title'
- 'editor' (content)
- 'author'
- 'thumbnail' (featured image, current theme must also support post-thumbnails)
- 'excerpt'
- 'trackbacks'
- 'custom-fields'
- 'comments' (also will see comment count balloon on edit screen)
- 'revisions' (will store revisions)
- 'page-attributes' (menu order, hierarchical must be true to show Parent option)
- 'post-formats' add post formats
- <?php
- add_action( 'init', 'create_posttype');
- function create_posttype() {
- register_post_type( 'acme_product',
- array(
- 'labels' => array(
- 'name' => __( 'Products'),
- 'singular_name' => __( 'Portfolio' )
- ),
- 'public' => true,
- 'supports' => array('author', 'thumbnail', 'title', 'editor', 'custom-fields'),
- 'has_archive' => true,
- 'rewrite' => array('slug' => 'products'),
- )
- );
- }
- ?>
- <!-- custom post query sample code -->
- <?php
- global $post;
- $args = array( 'posts_per_page' => -1, 'post_type'=> 'holistic-health');
- $myposts = get_posts( $args );
- foreach( $myposts as $post ) : setup_postdata($post); ?>
- <div class="single_column">
- <h4><?php the_title(); ?></h4>
- <?php the_post_thumbnail('fitness-page', array('class'=> 'img-thumb')); ?>
- <?php the_content(); ?>
- </div>
- <?php endforeach; ?>
- <!-- custom post query -->
- <!-- Change Post permalink -->
- Go to settings> Permalinks> Post name
- then enable rewrite module of wamp server
- Go to apache> apache modules> rewrite module> then restrat wamp server
- <!-- wordpress sever to server transfer -->
- 2 backup >
- a-wordpress all files backup to zip
- b-database backup
- upload all files backup to htdocs
- create new database
- import old database to new database (phpmyadmin)
- phpmyadmin> clilck property options> site url> edit> edit domain name
- edit wp config file
- after install wordpress > go to wordpress dashboard> settings> url > change *wordpress address url *site address url> save change
- <!-- Custom taxonomy -->
- 2 kinds of taxonomy >catagory >tag
- =====================================================================================================
- // Register Custom Taxonomy
- =====================================================================================================
- <?php
- function pages_taxonomy() {
- register_taxonomy(
- 'portfolio_cat', //1. The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces). example: portfolio_cat
- 'portfolio-items', //2. post type name , custom post id (register_post_type id): example: news_sites
- array(
- 'hierarchical' => true,
- 'label' => 'Portfolio Category', //3. Display name
- 'query_var' => true,
- 'rewrite' => array(
- 'slug' => 'portfolio-category', // 4. This controls the base slug that will display before each term
- 'with_front' => false // Don't display the category base before
- )
- )
- );
- }
- add_action( 'init', 'pages_taxonomy');
- ?>
- =====================================================================================================
- ট্যাক্সনমি ক্যাটাগরি ব্যবহারের সুবিধা:
- ধরা যাক পোর্টফোলিও একটা নির্দিষ্ট বিভাগ। এই পোর্টফোলিও বিভাগের পোস্ট গুলিকে আমি দুই ধরনের ক্যাটাগরিতে ভাগ করতে চাচ্ছি। >ফিচারড্ >সাধারন
- এখন ফিচারড্ ক্যাটাগরির পোস্টগুলি শুধুমাত্র হোম পেজে শো করবে।
- এবং সাধারন ক্যাটাগরির পোস্টগুলি পোর্টফোলিও পেজে শো করবে।
- <!-- taxonomy query -->
- <?php
- global $post;
- $args = array( 'posts_per_page' => -1, 'post_type'=> 'portfolio-items', 'portfolio_cat' => 'Featured'); //"Featured" only featured category post will be show here
- $myposts = get_posts( $args );
- foreach( $myposts as $post ) : setup_postdata($post); ?>
- <!-- Your div -->
- <?php endforeach; ?>
- <!-- for featured image custom post -->
- paste this code to functions.php
- <?php
- add_theme_support( 'post-thumbnails', array( 'post' ) );
- add_theme_support( 'post-thumbnails', array( 'portfolio-items') ); //"portfolio-items" is custom post registered id
- ?>
- <!-- for featured image crop -->
- <?php
- add_image_size( 'portfolio-thumb', 220, 105 );
- ?>
- <!-- for featured image quary code -->
- <?php the_post_thumbnail('portfolio-thumb', array('class' => 'imgthumb')); ?>
- ***টপিকস্:
- কাস্টম পোস্ট থেকে কিভাবে কাস্টম ফিল্ডে ডেটা নিয়ে আসা যায়-
- প্রথমত: কাস্টম পোস্টের ভিতর কাস্টম ফিল্ডের জন্য একটা ভেরিয়েবেল নিতে হবে।
- দ্বিতীয়ত: if endif এর ব্যবহার
- তৃতীয়ত: echo get_template_directory_uri() এর বদলে echo variable
- উদাহরন:
- original costom post
- <?php
- global $post;
- $args = array( 'posts_per_page' => 4, 'post_type'=> 'portfolio-items', 'portfolio_cat' => 'Featured');
- $myposts = get_posts( $args );
- foreach( $myposts as $post ) : setup_postdata($post); ?>
- <div class="work span3">
- <?php the_post_thumbnail('portfolio-thumb', array('class' => 'imgthumb')); ?>
- <h4><?php the_title(); ?></h4>
- <?php the_content(); ?>
- <!-- from here (custom post to custom field data)-->
- <div class="icon-awesome">
- <a href="<?php echo get_template_directory_uri(); ?>/assets/img/portfolio/work1.jpg" rel="prettyPhoto"><i class="icon-search"></i></a>
- <a href="portfolio.html"><i class="icon-link"></i></a>
- </div>
- <!-- to here-->
- </div>
- <?php endforeach; ?>
- উদাহরন:
- modified costom post
- <?php
- global $post;
- $args = array( 'posts_per_page' => 4, 'post_type'=> 'portfolio-items', 'portfolio_cat' => 'Featured');
- $myposts = get_posts( $args );
- foreach( $myposts as $post ) : setup_postdata($post); ?>
- <!-- variable start-->
- <?php
- $large_image= get_post_meta($post->ID, 'large_image', true);
- $portfolio_link= get_post_meta($post->ID, 'portfolio_link', true);
- ?>
- <!-- variable end-->
- <div class="work span3">
- <?php the_post_thumbnail('portfolio-thumb', array('class' => 'imgthumb')); ?>
- <h4><?php the_title(); ?></h4>
- <?php the_content(); ?>
- <div class="icon-awesome">
- <!-- use of if endif - যদি ডেটা ইনপুট করা হয় তবে এ অংশটি দেখাও; অন্যথায় এ অংশটি বাদ যাক-->
- <?php if($large_image) : ?>
- <a href="<?php echo large_image; ?>" rel="prettyPhoto"><i class="icon-search"></i></a>
- <?php endif; ?>
- <!-- use of if endif and else - যদি ডেটা ইনপুট করা হয় তবে এ অংশটি দেখাও; অন্যথায় এ লিংকটি সিঙ্গেল পোর্টফোলিও পেজে চলে যাবে-->
- <?php if($portfolio_link) : ?>
- <a href="portfolio.html"><i class="icon-link"></i></a>
- <?php else : ?>
- <a href="<?php the_permalink(); ?>"><i class="icon-link"></i></a>
- <?php endif; ?>
- </div>
- </div>
- <?php endforeach; ?>
- <!-- End -->
- ***টপিকস্:
- option framework (Option tree)
- wordpress.org থেকে option tree প্লাগিন ডাউনলোড
- এরপর option tree ফোল্ডারটি থিম ফোল্ডারের ভেতর রেখে দিতে হবে। এভাবে এটি থিমের সাথে ইন্টিগ্রেট করে দিতে হবে। (প্লাগিন হিসাবে দিলে হবে না।)
- এরপর এর ভেতর option tree ফোল্ডারটির ভেতর ot-loader.php ফাইল ফাংশনে ইনক্লুড করে দিতে হবে।
- doc link http://goo.gl/GYJrXF
- <!-- Activate Option Tree (put this code into functions.php)-->
- add_filter( 'ot_show_pages', '__return_false' );
- add_filter( 'ot_show_new_layout', '__return_false' );
- add_filter( 'ot_theme_mode', '__return_true' );
- include_once( 'option-tree/ot-loader.php' );
- include_once( 'includes/theme-options.php' );**
- এরপর Option tree ফোল্ডারের ভেতর Option tree>assets>theme-mode>demo-theme-options.php ফাইল কপি
- এরপর থিম ফোল্ডারের ভেতর create new folder -name inc > এখানে আগের কপি ফাইলটি পেস্ট > রিনেম theme-options.php
- এরপর functions.php তে এটি চিনিয়ে দেয়া **include_once( 'includes/theme-options.php' ); এটার পরিবর্তে
- **include_once( 'inc/theme-options.php' );
- theme options এর settings গুলি তিনটি অংশে বিভক্ত থাকে 1-contextual_help 2-sections 3-settings
- =======================================================================================
- ব্লগ সাইট ছাড়া কোন বিজনেস সাইট করলে index.php কে homepage হিসাবে ব্যবহার করা যাবে না। এক্ষেত্রে index.php কে welcome template বানিয়ে welcome page হিসাবে ব্যবহার করতে হবে।
- index.php কে page হিসাবে ব্যবহার:
- index.php কে page হিসাবে ব্যবহার করতে হলে index কে আলাদা একটা template নিতে হবে।
- আর সেই template কে welcome page হিসাবে ব্যবহার করতে হবে।
- এজন্য index.php কে কপি করে রিনেম করতে হবে। template-welcome.php
- <?php
- /*Template Name: Welcome Template*/
- ?>
- pages> add new page > নাম Home > Template- welcome template > publish
- pages> add new page > নাম Blog > Template- Default template > publish
- Settings> reading> A static page > Front page-Home & Post page-Blog
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement