WordPress.org

Forums

Exray
Child theme for exray (7 posts)

  1. erikiva
    Member
    Posted 1 year ago #

    I am trying to use exray with a child theme but it doesn't seem possible without basically copying all the files over and modifying them.
    I want to change the function that opens the main content part get_exray_content_html_opening but if I create it in the child theme it tells me it is already defined, since it isn't declared with if ( ! function_exists

    So the alternative seems to be to create a diferent function with the modifications but this function is called in all the template files ie: index.php, page.php, category.php etc...so basically I might as well just modify the original template.

    Anybody has a different suggestion?

  2. Edde Poon
    Member
    Posted 1 year ago #

    The reason you dont modify the original template is the fact that when a theme is updated you lose all your modified css. Your child theme is protected from updates.

    You can still copy all files to your child theme folder and edit from there.

  3. erikiva
    Member
    Posted 1 year ago #

    I know, what I meant is that if I override all the files there won't be much point in making updates.

  4. but it doesn't seem possible without basically copying all the files over and modifying them.

    That really depends on what you want to change.

    I want to change the function that opens the main content part get_exray_content_html_opening but if I create it in the child theme it tells me it is already defined, since it isn't declared with if ( ! function_exists

    *Looks at theme*

    That's unfortunate. If that function was added via a filter or action then you could remove it from the queue so that it doesn't fire. But it's embedded in the following templates.

    attachment.php:10:		 <?php get_exray_content_html_opening(); ?>
    category.php:10:        <?php get_exray_content_html_opening(); ?>
    functions/exray-theme-template.php:304:function get_exray_content_html_opening(){
    index.php:14:        <?php get_exray_content_html_opening(); ?>
    page-archives.php:15:	        <?php get_exray_content_html_opening(); ?>
    page.php:10:        <?php get_exray_content_html_opening(); ?>
    search.php:10:        <?php get_exray_content_html_opening(); ?>
    single.php:10:		 <?php get_exray_content_html_opening(); ?>
    tag.php:10:        <?php get_exray_content_html_opening(); ?>

    What change are you trying to accomplish? Their may be other ways to pull that off without copying all of those files.

  5. erikiva
    Member
    Posted 1 year ago #

    Yep, exactly, that's the problem it is neither done with if !funtion not atached to hooks or filters so in fact I can't redifine it, just have all thos templates call another funcion and stop calling that one.
    I want to insert a widget area above the main content. I'll try with maybe a before_loop hook? Would that work?

    Either way I'll have the same problem with any layout change because it is mostly done like that with direct calls to functions.

  6. Do you want it to be after the head portion and before the loop?

  7. erikiva
    Member
    Posted 1 year ago #

    I have the layout with right and left columns and I want it above the main column/content.
    I tried below the header so I only had to change the header but that pushes down not only the middle main column but also the sides leaving white spaces above the side columns..

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic