• Resolved ananzhe25

    (@ananzhe25)


    Hi,

    I need my theme gallery flex slider to bring this plugins gallery images. I tried inserting custom post type”advert” in different places in this code but didn’t work.

    Here is the code:

    function tie_gallery(){
    
    global $post, $tie_blog;
    
    if( is_singular() || tie_get_option( 'on_home' ) != 'grid' || isset( $tie_blog )){
    
        $size  = 'post' ;
    
    }else{
    
        if( tie_post_width() == 'w2' ){
    
            $size  = 'w2' ;
    
        }
    
        elseif( tie_post_width() == 'w3' ){
    
            $size  = 'w3' ;
    
        }
    
        else {
    
            $size  = 'w1' ;
    
        }
    
    }
    
    $speed = 7000 ;
    
    $time = 600;
    
    $effect = 'animation: "fade",';
    
    ?>
    
    <?php 
    
        $custom = get_post_custom($post->ID);
    
        $slider = unserialize( $custom["post_gallery"][0] );
    
        $number = count($slider);
    
        $imgaes = array();
    
        if( $slider ){
    
        foreach( $slider as $slide ){
    
            $image = wp_get_attachment_image_src( $slide['id'] , 'tie-'.$size  );
    
            $imgaes[] = array( $image[0] , $image[1] ,  $image[2]);
    
        }?>
    
    <div class="flexslider">

    Any help is appreciated. I played in this code for hours but no hope.

    https://wordpress.org/plugins/wpadverts/

Viewing 1 replies (of 1 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi, i am not really familiar with the Flex Slider plugin, but as far as the WPAdverts goes, you can list all Ad images using ths code

    $images = get_children(array('post_parent'=>$post_id));
    if( !empty($images) ) {
      foreach($images as $tmp_post) {
        $image = wp_get_attachment_image_src( $tmp_post->ID, 'large' );
        if(isset($image[0])) {
          esc_attr_e($image[0]);
          echo "<br/>";
        }
      }
    }

    If $post_id will be null then the code will list all files in media library;

Viewing 1 replies (of 1 total)

The topic ‘Gallery Get Post Custom for Custom Post’ is closed to new replies.