0

In WordPress 6.0 new block theme (full site editing themes) there are no PHP pages, only a HTML template and template parts. I installed Astory (full site editing theme). I added my external PHP page by adding as a custom template in the WordPress page. But I am unable to get other header, footer, sidebar blocks and styles.

How can I include a custom PHP code page with theme template style in the new full site editing themes?

    <?php
/**
 * @package astory-child
 */


 /* Template Name: member_register_page */ 
 


  ?>

    
    
    <?php

    get_header();

    ?>
    
    </main>

             
                    
                        <div class="pageheading"><h1><?php the_title(); ?></h1></div>
                        
                        
                        
                            <?php the_content();
                            
            

global $wpdb;

        //$memberhousedet = $wpdb->get_results("SELECT * FROM wp_fluentform_entry_details WHERE field_name in ('house_no','house_name','house_ownr') GROUP BY id HAVING count(field_name)=1 ORDER BY submission_id");  -> TRASHED VALUES AVOIDED
        
        $memberhousedet = $wpdb->get_results("SELECT * FROM wp_fluentform_entry_details WHERE field_name in ('house_no','house_name','house_ownr') and submission_id NOT IN (SELECT id FROM `wp_fluentform_submissions` where status='trashed' and form_id=6) GROUP BY id HAVING count(field_name)=1 ORDER BY submission_id");
          foreach($memberhousedet as $housedet){
             //echo '<br/>'; 
             $hstblsbvlidary[]= $housedet -> submission_id;
             
              $housetblid= $housedet -> id;
              $housedetsbmsnval= $housedet -> submission_id;
              $housedetres= $housedet -> field_name;
              $housedetval= $housedet -> field_value ;
            $housedetvals[] = array($housetblid,$housedetsbmsnval,$housedetres, $housedetval);
            //$housedetvals[]= array('id'=>$housetblid,'sbval'=>$housedetsbmsnval,'fieldname'=>$housedetres,'value'=>$housedetval);
            //echo '<br/>';
          }
          $distnctsbvals=array_unique($hstblsbvlidary); 
            //print_r($housedetvals);
            
            $cntoftothusdet=count($housedetvals);
             $cntofdstnctentry=count($distnctsbvals);
             $rstarykeyvals=array_values($distnctsbvals);
             //print_r($rstarykeyvals);
              
             for($i=0;$i<$cntofdstnctentry;$i++){
                                            
                 // $rstarykeyvals[$i];  
                 $cnt=0;
                
                 while($cnt<$cntoftothusdet){
                      
                     if($rstarykeyvals[$i]==$housedetvals[$cnt][1]){
                     //echo '<br/>';
                     //echo $housedetvals[$cnt][1].' , '.$housedetvals[$cnt][2].' , '.$housedetvals[$cnt][3];
                
                    $hsdetcmbndary[$housedetvals[$cnt][1]][$housedetvals[$cnt][2]]=$housedetvals[$cnt][3];
                    
                                        
                 }
                 $cnt++;
                 }
                 //
                 
                 
             }
            // print_r($rstarykeyvals);
            //$hsdetcmbndary[204]['house_no']['house_name'];
            // echo $hsdetcmbndary[204]['house_no'].' - '.$hsdetcmbndary[204]['house_name'];
            
            $ic=0;
            
            while($ic<$cntofdstnctentry){
             
              $housnonnamepasngary[] = $hsdetcmbndary[$rstarykeyvals[$ic]]['house_no'].' - '.$hsdetcmbndary[$rstarykeyvals[$ic]]['house_name'];
              
              if (isset($hsdetcmbndary[$rstarykeyvals[$ic]]['house_ownr'])){
                 
                  $housownernmpsngary[$hsdetcmbndary[$rstarykeyvals[$ic]]['house_no'].' - '.$hsdetcmbndary[$rstarykeyvals[$ic]]['house_name']]=$hsdetcmbndary[$rstarykeyvals[$ic]]['house_ownr'];
              }else{
                     $housownernmpsngary[$hsdetcmbndary[$rstarykeyvals[$ic]]['house_no'].' - '.$hsdetcmbndary[$rstarykeyvals[$ic]]['house_name']]='-';
              }
             
             $ic++; 
            }
            
             //print_r($housownernmpsngary);print_r($housnonnamepasngary);  // -> This array has to be passed to jQ for populate in dropdown   
             
                
            
            
            $encodedpasableary = json_encode($housnonnamepasngary);
            $hsownrjsnary = json_encode($housownernmpsngary);
            
            // echo $hsownrjsnary;
            echo '<div class="wp-block-columns">';
            
            
            //$unq_mem_id=$_POST['unq_id'];  $mem_id=$_POST['mem_id'];
            
            
            echo do_shortcode( '[fluentform id="7"]' );
     
            echo '</div>';
    
         ?>
        
          <script>
    jQuery(document).ready(function($){
        
        var jsonhsvals = <?php echo $encodedpasableary; ?>;
        var jsnhsownrvals = <?php echo $hsownrjsnary; ?>;
        
        //var housdetvals = $.parseJSON(jsonhsvals.value);
        //JSON.stringify(myobject); 
        console.log(jsonhsvals);
        $cntofhousdetary=jsonhsvals.length;
        for(i=0; i<$cntofhousdetary; i++) {
        $('#ff_7_house_name_select').append("<option value='"+jsonhsvals[i]+"'>"+jsonhsvals[i]+"</option>");   
        
        }
        
        //alert(jsonhsvals.length);
        
        $("#ff_7_housownr").prop('readonly', true);
        
        //var conceptName = $('#aioConceptName :selected').text();
            $('#ff_7_house_name_select').change(function(){
                //alert('dropdown value changed !!!'); alert($(this).val()); 
                     var slctd_housenonam=$(this).val();  
                     $("#ff_7_housownr").val(jsnhsownrvals[slctd_housenonam]);
                    
                    
                    
                         
               });
        });   
        
        
         </script>   

            
   
<?php

 get_footer(); 
?>

This is a fluent form registration table with dynamic popup and selection added by PHP and jQuery. I want to add this PHP page into my WordPress theme with the same theme styles.

In the old theme I can add by copying div classes from page.php, but in the new block theme there is no page.php page, so I can’t add the same theme style.

1
  • Please share your custom WordPress page code, Without it, we can't suggest anything. Commented Oct 8, 2022 at 16:49

1 Answer 1

1

Found a useful site regarding all information regarding adding php templates in wordpress block themes.

Here the link :

https://fullsiteediting.com/lessons/how-to-use-php-templates-in-block-themes/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.