Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #887175

    I have a child theme and have created a new “page.php” file in the child folder. I want to add some static content that displays on top of all of my pages – regardless of whether I use the default or advanced layout editor. How can I dod this?

    <div class='container'>
    HOW DO I ADD STATIC CONTENT HERE?
    				<main class='template-page content  <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content','post_type'=>'page'));?>>
                        <?php
                        /* Run the loop to output the posts.
                        * If you want to overload this in a child theme then include a file
                        * called loop-page.php and that will be used instead.
                        */
    
                        $avia_config['size'] = avia_layout_class( 'main' , false) == 'fullsize' ? 'entry_without_sidebar' : 'entry_with_sidebar';
                        get_template_part( 'includes/loop', 'page' );
                        ?>
    				<!--end content-->
    				</main>
    
    • This topic was modified 6 years, 11 months ago by frescova.
    #887213

    Hey Martin,
    You can write html in that part of the page, try wrapping in a div, like this:

    <div class='mycontent'>HOW DO I ADD STATIC CONTENT HERE?</div>

    Best regards,
    Mike

    #887219

    Mike, thanks for the response. The only time any content shows up in that portion of the page is if I use the default editor. As soon as I go into the advanced layout editor any code I add disappears…

    #887221

    My file

    <?php
    	if ( !defined('ABSPATH') ){ die(); }
    	
    	global $avia_config;
    
    	/*
    	 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
    	 */
    	 get_header();
    
     	 if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title();
     	 
     	 do_action( 'ava_after_main_title' );
    	 ?>
    
    		<div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
    
    			<div class='container'>
    						
    			<div>
    			<h2>My content</h2>
    			<p><?php the_field('status'); ?></p>
    			</div>
    								
    				<main class='template-page content  <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content','post_type'=>'page'));?>>
    
    								
                        <?php
                        /* Run the loop to output the posts.
                        * If you want to overload this in a child theme then include a file
                        * called loop-page.php and that will be used instead.
                        */
    
                        $avia_config['size'] = avia_layout_class( 'main' , false) == 'fullsize' ? 'entry_without_sidebar' : 'entry_with_sidebar';
                        get_template_part( 'includes/loop', 'page' );
                        ?>
    			
    				<!--end content-->
    				</main>
    
    				<?php
    
    				//get the sidebar
    				$avia_config['currently_viewing'] = 'page';
    				get_sidebar();
    
    				?>
    
    			</div><!--end container-->
    
    		</div><!-- close default .container_wrap element -->
    
    <?php get_footer(); ?>
    #887288

    Hi,

    Yes that is correct, if you use default editor the file that will be used is page.php however if you use Advanced Layout Builder you will be using this file: template-builder.php
    Hope this helps :)

    Best regards,
    Nikko

    #887462

    Thanks Nikko – my question remains:

    How do I add some static content that displays on top of all of my pages – regardless of whether I use the default or advanced layout editor?

    Editing the template-bulder.php file yields no results…

    #887695

    Hi frescova,

    If you are using default editor on page.php you can add the static content below this code:

    <div class='container'>

    As for Advanced Layout Builder, you need to manually it, unless it’s placed in the header or footer. :(

    Best regards,
    Nikko

    #887744

    Thanks Nikko; It dd not occur to me to add it to the header; with some conditionals it will do what I need. Thanks for the advice.

    #887875

    Hey!

    Glad we could help :)

    If you need further assistance please let us know.
    Best regards,
    Victoria

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.