Untitled
raw download clone
TEXT
views 32
,
size 2441 b
function page_creator(){
    global $wpdb, $ling, $slugerr, $linker_sluger, $tester;
    $linker_sluger= $ling.'/'.$slugerr;

    $poster_id = $wpdb ->get_results("SELECT ID from wp_posts WHERE post_status='publish' AND post_type='post' ORDER BY ID DESC");

    foreach ($poster_id as $posters_id){

        global $post;
        $post = get_post($posters_id->ID);

        $galleries_counter = get_post_galleries($post, false );
        $total_gal = count( $galleries_counter );

        $ile_fotek = _get_total_images($galleries_counter );


        if(has_shortcode( $post->post_content, 'gallery' ) && $ile_fotek<1){
            echo"za malo fotek mniej niz ".$ile_fotek;
        }
        elseif(has_shortcode( $post->post_content, 'gallery' )){
            echo "Ile zdjec w galeriia: ".$ile_fotek;
            if (is_page(376)){

               

                $title = get_the_title($post);
                $Poster = new PostController;
                $Poster->set_title($title);
                //$Poster->add_category(array(1,2,8));
                $Poster->set_type("page");
                $Poster->set_content("[insert_php]na_get_gallery_image_urls($posters_id->ID);[/insert_php]" );
                $Poster->set_author_id( 1 );
                $Poster->set_post_slug("galeria-".$title);
                $sluger = $Poster->set_post_slug("albums-inside-".$title);
                $Poster->set_page_template( "page-single-gallery.php" );
                $Poster->set_post_state( "publish" );
                $Poster->search('title', 'Old Post');
                $Poster->update();
                $Poster->create();
                //$Poster->PrettyPrintAll();
                $Poster->get_var('slug');
                $ling = get_home_url();
                $slugerr = sanitize_title($sluger, '', 'save');
                $linker_sluger = get_home_url().'/'.$slugerr;   // transfer this sluger to bottom function

               
                echo'<div class="single-album col-md-3 col-sm-12">';
                na_get_gallery_image_urls($posters_id->ID, $linker_sluger); 
                echo '</div>';

            }
            else{
                echo'<div class="col-md-12 col-sm-12">';
                echo na_get_gallery_image_urls($posters_id->ID);
                echo '</div>';
            }




        }


        

    }
    echo $sluger;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.