• Resolved markandweather

    (@markandweather)


    I try to modify Mesocolumn Theme and I have a question about inserting some extra script.

    I want to have a content from file.php in Advertisement location settings in Top Header. I’ve already have a banner with weather data but I would like to add some extra content under it to show some infos about present day.

    For now I have Advertisment Embed Code as follows:
    <?php include('data.php'); ?>

    And data.php content is not visible. How should be the script included? I would be grateful for your help.

    My webpage: https://gminaslesin.futurehost.pl/
    And old version of my website where under the weather banner there is a text from data.php:
    https://gminaslesin.hostpark.pl/news.php

Viewing 14 replies - 1 through 14 (of 14 total)
  • Theme Author Richie KS

    (@rkcorp)

    you need the full path like

    include( get_template_directory() . '/data.php' );
    if the file is in mesocolumn/data.php

    if its in mesocolumn/lib/templates/data.php then
    include( get_template_directory() . '/lib/templates/data.php' );

    Thread Starter markandweather

    (@markandweather)

    Thank you for your advice.

    <?php include( get_template_directory() . '/data.php' ); include( get_template_directory() . '/icon.php' ); ?>

    The script above works but when I put it in Theme Editor in header.php
    It is not executed after inserting into ‘Ad location’ window – “Top Header”.

    So, my question is now where should I paste the script to have the text just below the weather banner?

    Theme Author Richie KS

    (@rkcorp)

    you can’t add this code in ad location in customizer. try add this to functions.php

    remove_action('bp_inside_header','meso_add_topheader_ads');  
    function meso_add_topheader_alt_ads() {
    $header_banner = get_theme_mod('header_embed');
    if($header_banner) {
    echo '<div id="topbanner">' . stripcslashes(do_shortcode($header_banner)) . do_action('bp_inside_top_header') . '</div>';
    }
    }
    add_action('bp_inside_header','meso_add_topheader_alt_ads');
    
    /* add the custom ads */
    function meso_add_header_custom_ad() {
    include( get_template_directory() . '/data.php' ); 
    include( get_template_directory() . '/icon.php' );
    }
    add_action('bp_inside_top_header','meso_add_header_custom_ad');
    Thread Starter markandweather

    (@markandweather)

    Thank you for your code. I entered it to functions.php. In ad location in customizer I still have:
    <img src='https://slesinpogoda.cba.pl/pogoda.php' style='margin:1px' alt='' align='right' />

    because when I deleted it all script disappeared.

    Now, the text is in a correct area but still there are double banners visible and the text from data.php is above the banner, not under it and not starting in the same line as a banner ??
    https://gminaslesin.futurehost.pl/

    Theme Author Richie KS

    (@rkcorp)

    remove the previous code and add this

    function meso_remove_init_call() {
    remove_action('bp_inside_header','meso_add_topheader_ads');
    }
    add_action('init','meso_remove_init_call');
    
    function meso_add_topheader_alt_ads() {
    $header_banner = get_theme_mod('header_embed');
    if($header_banner) {
    echo '<div id="topbanner">' . stripcslashes(do_shortcode($header_banner));
    echo '<div style="clear:both;">';
    echo do_action('bp_inside_top_header');
    echo '</div>';
    echo '</div>';
    }
    }
    add_action('bp_inside_header','meso_add_topheader_alt_ads');
    
    /* add the custom ads */
    function meso_add_header_custom_ad() {
    include( get_template_directory() . '/data.php' ); 
    include( get_template_directory() . '/icon.php' );
    }
    add_action('bp_inside_top_header','meso_add_header_custom_ad');
    Thread Starter markandweather

    (@markandweather)

    I think it’s almost done. But still the second part of the text from data.php is disturbed by the content from icon.php. The below placed menu is also lowered.
    https://gminaslesin.futurehost.pl/

    Is it possible to set the content like here:
    https://gminaslesin.hostpark.pl/news.php ?

    Theme Author Richie KS

    (@rkcorp)

    this is css or html issue, you need to adjust it yourself, i cannot help you step by step when it involve css or html. i have no idea what the code in data.php are.

    Theme Author Richie KS

    (@rkcorp)

    best step, try add class to the div like this
    echo '<div class="secbanner" style="clear:both;">';

    and add this css

    .secbanner img {position:absolute;right:20px;top:90px;}
    .secbanner {font-size:10px;text-align:left;line-height:15px;}
    .secbanner b {display:inline;clear:none;}
    .secbanner center {text-align:left;}
    Thread Starter markandweather

    (@markandweather)

    Thank you very much for your help. Your last advice was also useful. I modified css and now it lookes fine.

    By the way, by default below my logo I have all positions of menu in blue (main categories). Is it possible to make them colourful so that they have colours of particular categories?
    The last think – translations of such parts like: “You are here: Home”, “No Comment”. Could you indicate me where can I change it into my language?

    Thread Starter markandweather

    (@markandweather)

    If it goes about colorful menu I managed to do it by creating Custum Menu and set it as a Primary Menu. However, I had to delete descriptions of categories because they were also visible.

    Theme Author Richie KS

    (@rkcorp)

    The last think – translations of such parts like: “You are here: Home”, “No Comment”. Could you indicate me where can I change it into my language?

    this is a translation method, check wp codex on how to translate to your language.

    #description
    there’s no need to delete the category description, you just need to edit the ‘description’ in each item on menu.
    https://www.dezzain.com/wordpress-tutorials/how-to-use-wordpress-navigation-menus/
    check #3 but in your case delete menu description.

    • This reply was modified 7 years, 3 months ago by Richie KS.
    • This reply was modified 7 years, 3 months ago by Richie KS.
    Thread Starter markandweather

    (@markandweather)

    I submitted my translation proposals. I hope they will be approved and introduced.

    In other themes I had a possibility to see quantity of reads for every post next to the number of comments for each post. So it was a nice and fast confirmation how many people opened particular posts. Is there maybe a script to add such info in Mesocolumn Theme next to the comment info?

    Theme Author Richie KS

    (@rkcorp)

    the theme did not have this. try using plugin.

    Thread Starter markandweather

    (@markandweather)

    Indead, I used WP-PostViews plugin and I have it.

    Another thing. Next to the label (caption) of images inserted into the text of post or page there is a short horizontal line, e.g. on the page https://gminaslesin.futurehost.pl/o-gminie/srodowisko-przyrodnicze/. How to get rid of it? Where can I do it?

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Including external php file content in Mesocolumn theme’ is closed to new replies.