WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Twelve Parse Error (15 posts)

  1. Chip G.
    Member
    Posted 1 month ago #

    Hello— attempting to remove the header from a specific page I inserted code from a wordpress twenty twelve thread into my child theme functions.php editor. Doing so has led me to, Parse error: syntax error, unexpected '<' in /home/charlieb/public_html/wp/wp-content/themes/twentytwelve-child/functions.php on line 9

    removing this code from the editor does not bring my site back. Please advise. Thank you

  2. alchymyth
    Forum Moderator
    Posted 1 month ago #

    what is the full code of your child theme's functions.php ?

  3. Chip G.
    Member
    Posted 1 month ago #

    ? Other tha posted text what specifically should I look for?

    Parse error: syntax error, unexpected '<' in /home/charlieb/public_html/wp/wp-content/themes/twentytwelve-child/functions.php on line 9

  4. alchymyth
    Forum Moderator
    Posted 1 month ago #

    please post the full code of your child theme's functions.php file, so somebody can check where the error is.

    you might have added a new php tag where one was already open (?)

  5. Chip G.
    Member
    Posted 1 month ago #

    Hello— I recognize in the code is_page(id=443) is what I added and obviously incorrect. What should be between the parenthesis to get me back to initial order?

    <?php
    // Exit if accessed directly
    if ( !defined('ABSPATH')) exit;
    
    /* Add custom functions below */
    remove_action( 'woocommerce_pagination', 'woocommerce_catalog_ordering', 20 );
    
    <?php $header_image = get_header_image();
    if ( ! empty( $header_image ) && is_page(id=443) ) : ?>
    	<a>"><img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a>
    <?php endif; ?>
  6. Andrew
    Forum Moderator
    Posted 1 month ago #

    Can you re-post that? The above code was corrupted by the forum's parser. Remember to wrap your code in backticks.

  7. Chip G.
    Member
    Posted 1 month ago #

    <?php
    // Exit if accessed directly
    if ( !defined('ABSPATH')) exit;
    
    /* Add custom functions below */
    remove_action( 'woocommerce_pagination', 'woocommerce_catalog_ordering', 20 );
    
    <?php $header_image = get_header_image();
    if ( ! empty( $header_image ) && is_page(id=443) ) : ?>
    	<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a>
    <?php endif; ?>
  8. Andrew
    Forum Moderator
    Posted 1 month ago #

    That's corrupted again, can you instead post it on PasteBin and share us a link to that?
    http://pastebin.com

  9. Chip G.
    Member
    Posted 1 month ago #

  10. Andrew
    Forum Moderator
    Posted 1 month ago #

    Okay so I can see a syntax error here:

    <?php $header_image = get_header_image();

    Do you see that you don't need to open PHP here, you don't need this bit:

    <?php
  11. Chip G.
    Member
    Posted 1 month ago #

    Yes, I see and understand to remove that bit. But, I did add the (id=443) Shouldn't that be changed to what it was initially?

  12. Andrew
    Forum Moderator
    Posted 1 month ago #

    Try remove the "id=" bit

  13. Chip G.
    Member
    Posted 1 month ago #

    Okay, I'm back up to where I started. I thank you Andrew.

    Should I begin a new thread to learn how to remove the header from only 1 page of my site?

  14. Andrew
    Forum Moderator
    Posted 1 month ago #

    That'll probably increase the likelihood that you'll receive help, yes :)

  15. Chip G.
    Member
    Posted 1 month ago #

    Okay. Again, thank you for your troubleshooting.

Reply

You must log in to post.

About this Topic