Advertisement
firoze

Cuctom Meta Box (CMB) ব্যবহার করে images upload করার নিয়ম

Dec 11th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.40 KB | None | 0 0
  1. // Cuctom Meta Box (CMB) ব্যবহার করে images upload করার নিয়ম |
  2. /*****************************************************************************************/
  3. <!---------------------------------------------------------------------------------------->
  4. <?php
  5. global $post;
  6. $args = array( 'posts_per_page' =>-1, 'post_type'=> 'twenty_slider'); // thiscome from custom-posts.php                  
  7. $myposts = get_posts( $args );
  8. foreach( $myposts as $post ) : setup_postdata($post); ?> <!----- endforeach start here & see below------>
  9.  
  10. <!------------------------------------------------------------------------------------------->
  11. <?php
  12.  $image = get_post_meta($post->ID, 'twenty_meta_img1', true); // This is for custom meta box (CMB)
  13. ?>
  14.  
  15. <!------------------------------------------------------------------------------------------------->
  16. <?php if($image):?>
  17. <img src="<?php  echo $image;?>"   alt="" style="height:297px;width:593px;"/> <!--this has beeen called from CMB data input--->
  18. <?php else:?> <!---if the above image did not found then the below image will get from our theme directory this is default-->
  19. <img src="<?php echo get_template_directory_uri();?>/img/1_1.jpg" alt="" />
  20. <?php endif;?>
  21.  
  22. <!----------------------------------------------------------------------------------------------------------->
  23.  
  24. <?php endforeach;?> <!----- endforeach end here & see above------>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement