• Resolved Anonymous User 4104441

    (@anonymized-4104441)


    Hello, I’ve faced a weird problem:
    for some reason, each time i use <?php get_template_part( '' ); ?>
    it gives me this weird quotes in analyzer:
    i.imgur.com/WOZZI.png
    which results in empty space on my design.

    What am i doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Get_template_part($slug,$name);

    The {slug} relates to a template file, the {name} relate to a custom template file.

    So look at an example from category.php

    <?php get_template_part('content','category'); ?>

    It is looking for a file content-category.php, if it cannot find the file then it will fall through to just content.php

    If we create a custom loop for our template page, lets call it content-custom.php

    <?php get_template_part('content','custom'); ?>

    Lets say we are adding a social.php a social media bar to our theme

    <?php get_template_part('social'); ?>

    However we want one in the header and a different layout in the footer, we have social-header.php and social-footer.php we call these:

    <?php get_template_part('social','header'); ?>
    <?php get_template_part('social','footer'); ?>

    Conclusion:
    You are not passing a file name in so “” is returned.

    HTH

    David

    Thread Starter Anonymous User 4104441

    (@anonymized-4104441)

    I see now, thank you so much David!

    It’s a learning curve!

    Can you mark this topic as resolved please.

    David

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get_template_part inserts "quotes" in my theme’ is closed to new replies.