-
AuthorPosts
-
December 11, 2017 at 1:40 am #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.
December 11, 2017 at 4:53 am #887213Hey 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,
MikeDecember 11, 2017 at 5:05 am #887219Mike, 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…
December 11, 2017 at 5:13 am #887221My 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(); ?>
December 11, 2017 at 11:26 am #887288Hi,
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,
NikkoDecember 11, 2017 at 3:36 pm #887462Thanks 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…
December 12, 2017 at 4:57 am #887695Hi 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,
NikkoDecember 12, 2017 at 6:55 am #887744Thanks 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.
December 12, 2017 at 12:26 pm #887875Hey!
Glad we could help :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.