Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* থিমে ফিথিমে ফিচার ইমেজ সাপোর্ট করানোর জন্য কোড functions.php file */
- add_theme_support( 'post-thumbnails', array( 'post' ) );
- /* এখানে আপনি যদি পেজেও ফিচার ইমেজ দিতে চান তাহলে page টি যুক্ত করতে হবে। যেমন */
- add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
- /*বিভিন্ন সাইজের ইমেজ থাম্বনেইল জেনারেট*/
- add_image_size( 'post-image', 450, 150, true );
- এখানে প্রথমটি width ও পরেরটি height
- /* ইমেজ যেভাবে কল করতে হবে */
- শুধু ইমেজের লিংক : <?php $my_featured_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘my_image_id’ );
- echo $my_featured_img[0]; ?>
- নোট: এটা ব্যবহার করলে শুধু ইমেজ এর লিংক আসবে তাই <img src="এখানে উপরের কোডটা দিতে হবে" alt=""/>
- like <img src="<?php $my_featured_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'my_image_id' ); echo $my_featured_img[0]; ?>" alt=""/>
- ইমেজ src অটোমেটিক কল: <?php the_post_thumbnail('my_image_id', array('class' => 'imgthumb')); ?>
- //or
- <?php the_post_thumbnail(‘my_image_id’); ?>
- এথানে array দিয়ে আলাদা ক্লাস নেওয়া হয়েছে। এখানে post-image দিয়ে নির্দিষ্ট সাইজের ইমেজ নেওয়া হচ্ছে যেটাকে ফাংশনে দেওয়া হয়েছিল। চার ইমেজ ব্যবহারের নিয়মাবলী
- /* imgage with img link */
- <a href="<?php $my_featured_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'my_image_id' ); echo $my_featured_img[0]; ?>" rel="prettyPhoto[gallery1]">/*eta link */
- /*img photo-image ekhane img crob size id/calss*/
- <img src="<?php $my_featured_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'my_image_id' ); echo $my_featured_img[0]; ?>" alt="" title="#<?php the_ID(); ?>"
- />
- </a>/* link ses */
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement