Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter aikibe

    (@aikibe)

    Dont nest <?php ?> blocks, and do not open one before terminating other so no <?php
    <?php ?> ?> Dont reopen them just use the one you started with gotcha!
    You can use this as much as you like, but it has to end with ?> not nested.
    Than do I see <?php ?> blocks like a initialization or a translation? because they are only for initialization as php language?
    Is this ok?
    <?php if ( something ); ?>
    <?php else : (something second); ?> Per if statement.

    <div> </div> I can leave out of the php blocks?
    The page is now coming out without template.

    Ok like c++ ” ; ” ends a line.
    and use ” : ” for a follow up,

    ah } is like endif; that is better yes
    I get what you mean, sometimes without the : it still is ok, like a single if statement.

    I can try it like this:

    <?php
    /**
     * The template for displaying all pages
     *
     * This is the template that displays all pages by default.
     *
     * @link https://codex.wordpress.org/Template_Hierarchy
     */
    
    ?>
    get_header(); 
    
    	<div id="primary" class="content-area">
    	<main id="main" class="site-main post-wrap" role="main"> 
    	
    	<?php // If comments are open or we have at least one comment, load up the comment template. ?>		
    	
    	<?php 
    			if ( have_posts() ) :  
                                    
                                    while ( have_posts() ) : 
                                    
                                        the_post();
    
    				    get_template_part( 'content', 'page' );
    
    			
    
    				    if ( comments_open() || get_comments_number() ) :
    					
    			       	        comments_template();
    			
    				    endif; 
    	
    
    			        endwhile;
    	
    	?>
    
    	<?php 		
    			else :
    			
    				get_template_part( 'content', 'none' );
    	?>
    	<?php
    		        endif; 
    	?>
    
    		<?php consultent_edit_link(); ?>
    		<?php     get_footer(); ?>
    		
    		</main> <!-- /main -->
    	</div>
    
    <!-- /.post-wrap -->
    Thread Starter aikibe

    (@aikibe)

    Hello Andres, I thank you. This cleared the quad problems but still the page error comes up. There is no clarity why it is doing this, the code seems correct.

    If you know php, does it make sense to put a if and else statement with ending a endif? you would expect it to endif after the if.

    also after the <?php else : ?> is it normal to place a function with < ?php infront of it and not without?
    I am not familiar with php so please explain m8.

Viewing 2 replies - 1 through 2 (of 2 total)