• Resolved TesterGP

    (@testergp)


    Dear,

    I am using the Dazzling theme with slider on the homepage and the 3 widgets in full page version on the homepage. I am trying to add some text between the widgets and the footer. I did it by moddifying the index.php file from the dazzling theme by adding text between
    <?php get_sidebar();?> SOME TEXT <?php get_footer(); ?>
    But this didn’t work. How can I add text between the widgets area and the footer area on the homepage?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @testergp,

    I hope you are well today and thank you for your question.

    To achieve this you have to create child theme of Dazzling theme and if you are using Footer Widgets then add it in the footer.php file and if you are using Homepage Widgets then add it in the page.php file by overwriting these files in the child theme.

    To display the text only on home page use the code in that file like following.

    <?php
                // Checks if this is homepage to enable homepage widgets
                if ( is_front_page() ) :
                  echo "SOME TEXT";
                endif;
              ?>

    Best Regards,
    Movin

    Thread Starter TesterGP

    (@testergp)

    Dear Movin,
    Thx for your answer. It works when editing the footer.php file.
    Now I am trying to display the text using a specific function that also requires some code to be placed into the header and some code to be placed where the text must be displayed. If I test it out on one page, it all works perfectly.
    I try to apply it on the homepage now. I tried to add the function into header.php using the conditional code you mentionned above
    if ( is_front_page() ) :
    But that doesn’t work. Then I tried to add the code into the page.php file just above get_header(); but that doesn’t work neither.
    To give a concrete example how it works on one page :

    <?php
    function myfunction( $content ) {
    ...
    }
    get_header();
    ?>
    <div id="content" class="site-content container">
    	<div id="primary" class="content-area col-sm-12 col-md-12">
    		<main id="main" class="site-main" role="main">
    <?php function Myfunction2(){
    }
    		</main><!-- #main -->
    	</div><!-- #primary -->
    </div>
    <?php get_footer(); ?>

    With your solution I added function Myfunction2(){...} in the footer.php. Now I still need to add `function myfunction( $content ) {

    }` in a header of a fle, but can’t find which one to make it work.
    Can you help me with this?

    You are doing it wrong. you should not add any function in the theme template file but add it in the functions.php file of child theme so that it will be available in the all files and you can call it anywhere.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Homepage > how to add text between widgets and footer?’ is closed to new replies.