WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Code php wrongly and wp page stop working (10 posts)

  1. portega
    Member
    Posted 2 months ago #

    Hi,
    Im doing a e-commerce website, and I added this exact code

    <?php echo do_shortcode('[yith_woocommerce_ajax_search]'); ?>

    into functions.php

    After that, my wordpress admin page and website stop working, only showing me a blank page with no error sign, nor anything else.

    How can I fix this error?

    PS: Im a newbie, so I don't understand that well programing language. Please have patience with me.

  2. graphical_force
    Member
    Posted 2 months ago #

    You do not put shortcodes in the functions.php file. You put them where you want the shortcode to run. Most likely a page or post.

  3. portega
    Member
    Posted 2 months ago #

    yes, thanx, now I know that. But It cost me a lot!

    Do you know how do I fix the problem? Cause I can't get to the dashboard, everything is in blank.

  4. Michelle
    Member
    Posted 2 months ago #

    Don't put that code into functions.php. It should go on the theme file where you want it to display, maybe page.php or single.php. If you put it after the_content() on page.php for instance, it would display on every page of your site after the content.

    If you want to use the shortcode in a specific page or post, you'd go into the control panel and edit the page, then insert just this where you want it to appear:

    [yith_woocommerce_ajax_search]

  5. graphical_force
    Member
    Posted 2 months ago #

    Just remove it from the functions.php file. If you were editing the code through the admin, use can do what you need to by using ftp if you have access to the server.

  6. portega
    Member
    Posted 2 months ago #

    @graphical_force Im editing the code through the admin, and I do have access to the server. The only problem is that I don't know how to use it very well, so i can't quite remove it by myself.
    Could you guide me please? Like step by step instructions?

  7. graphical_force
    Member
    Posted 2 months ago #

  8. Michelle
    Member
    Posted 2 months ago #

    ... and once you FTP in, find your theme in wp-content/themes, download the functions.php file - make a copy as a backup - then edit it and re-upload into your theme.

  9. graphical_force
    Member
    Posted 2 months ago #

    Or if you are editing a theme that is not a custom one that you wrote, you should use a child theme: http://codex.wordpress.org/Child_Themes

  10. portega
    Member
    Posted 2 months ago #

    It worked!! Thank you so much Michelle and graphical_force!

Reply

You must log in to post.

About this Topic