Adding PHP code to the header

  • Adding PHP code to the header
    Viewing 9 posts - 1 through 9 (of 9 total)

  • heather
    Participant
    #10589

    Hi,

    This is continuing this topic: http://support.creiden.com/forums/topic/adding-php-code-to-the-header/

    I’m adding php code to activate a font-resizer in header-text-block.php. However, when I place the file in my child theme, it isn’t over-riding it’s parent. I’ve tried placing it at the root of my child theme and also using the same path as the parent but nothing. I tested it by adding it to the parent and it worked fine, so I don’t think it’s a problem with the code.

    Thanks


    heather
    Participant
    #10590
    This reply has been marked as private.

    heather
    Participant
    #10591
    This reply has been marked as private.

    Mohamed Nabil
    Moderator
    #10599

    Hi Heather,

    What we’ve added in version 3.1 was to make the header blocks templates overridable only through header-builder/partials, that folder contains the templates responsible for rendering.

    And I see you are editing header-text-block.php which is placed at header-builder/blocks, that folder contains the templates responsible for the form that appears in the admin.

    So in order to add font-resizer option or any other option in the form, we will add actions in version 3.5 to make the forms extendable too, and you can create your own hooks.

    And BTW to over-ride one of the rendering templates, you need to add the full path for example: creiden-framework/header-builder/partials/header_part-text.php

    Will let you know when we release the update.
    Thanks


    heather
    Participant
    #10604

    Thanks. I was able to override with the path you gave me. However, now a whole bunch of padding has been added to the header. How can I get rid of that?

    Thanks


    Mohamed Nabil
    Moderator
    #10608

    I’ve checked your code and it seems there are problems with the html added

    Check this image:

    I couldn’t find the fontResizer_place() function to investigate further,
    but the issue is happening because of the <p> tag used before <li> which is most probably rendered by the fontResizer_place() function.
    Removing the <p></p> tag will solve it.

    Thanks


    heather
    Participant
    #10611

    Yes! That was exactly what the issue was. Thanks so much


    Mohamed Nabil
    Moderator
    #10619

    Great 🙂


    Mohamed Nabil
    Moderator
    #10687

    Hi heather,

    Circleflip v3.5 is now available on Themeforest, when you update you will be able to add the font-resizer option to the form in the header-text-block.php within header-builder/blocks

    using this code

    add_action( 'circleflip_header_text_form_after','add_header_form_resizer',10 , 4 );
    
    function add_header_form_resizer( $header_name, $id_base, $order, $instance ) {
        $defaults = array(
                'align' => '',
                'text' => '',
                'font_resizer' => '',
            );
            $instance = wp_parse_args($instance, $defaults);
            extract($instance);
        ?>
        <div class="modalRow row clearfix">
            <div class="col-sm-7">
                <p class="settingName">
                    Text
                </p>
            </div>
            <div class="col-sm-5">
                <input type="text" class="input-full" value="<?php echo $font_resizer ?>" name="<?php echo $header_name.'[hb_block_' . $order . '][font_resizer]' ?>">
           </div>
        </div>
    <?php
    }
Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.